.net - Automapper fails using a Generic Method - Event though the Generic Type is not used -


i trying make generic method map properties on similar classes.

the following works:

    private shared sub createvaccessmap()         each prop in gettype(workrecordheader).getproperties()             mapper.createmap(of vaccess, workrecordheader)().formember(prop.name,                  sub(m) m.mapfrom(function(s) s.getfieldvalue(prop.name)))         next         mapper.createmap(of vaccess, workrecordheader)().formember(function(dest) dest.id, sub(opt) opt.ignore())     end sub 

but when add generic identifier fails (argument types not match) though not using generic type:

    private shared sub createvaccessmap(of t)() 'note change here         each prop in gettype(workrecordheader).getproperties()             ' following line fails on every property...             mapper.createmap(of vaccess, workrecordheader)().formember(prop.name,                  sub(m) m.mapfrom(function(s) s.getfieldvalue(prop.name)))         next         mapper.createmap(of vaccess, workrecordheader)().formember(function(dest) dest.id, sub(opt) opt.ignore())     end sub 


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -