c# - Pass type to generic method (nested generic) -


how can invoke following method while have not trootentity, have type:

public void class<trootentity>(action<iclassmapper<trootentity>> customizeaction) trootentity : class;

final goal run following code

var mapper = new modelmapper(); mapper.class<myclass>(ca => {     ca.id(x => x.id, map =>     {         map.column("myclassid");         map.generator(generators.highlow, gmap => gmap.params(new { max_low = 100 }));     });     ca.property(x => x.something, map => map.length(150)); }); 

it used create dynamic nhibernate hbm. more info available here

as related question see here , here.

you cannot code generic methods run passing runtime type.

generics need have type @ compile time.

you may need use reflection (see answer of mr. ferreira point on how that).


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -