AutoMapper and reflection -


my shared hosting company doesn't allow reflection. how can use automapper?

do have specify each property .formember?

mapper.createmap<person, persondata>()             .formember(dest => dest.name, o => o.mapfrom(src => src.name))             .formember(dest => dest.address, o => o.mapfrom(src => src.address)); 

thanks,

filip

automapper uses reflection.emit, sure can use automapper?

[edit]

dont know of uses without reflection, 1 had created xmldatamapper on codeplex uses reflection. difficult design 1 without reflection or reflection.emit

the simplest , basic way this, can use of 2 or both techniques.

public class conversionhelper {    public static classb convert(classa item)    {       return new classb() { id = item.id, name = item.name };    }     public static list<classb> convert(list<classa> list)    {       return list.select(o => new classb() { id = o.id, name = o.name }).tolist();    } }   public class classa {    public int id { get; set; }    public string name { get; set; } } public class classb {    public int id { get; set; }    public string name { get; set; } } 

from sample have given anyways trying map property 1 one, on same lines, lesser code.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -