How to map nested object to a falltern dto ?

瀏覽次數:23 次
跳到第一則未讀訊息

jar...@gmail.com

未讀,
2015年4月18日 凌晨4:13:462015/4/18
收件者:automapp...@googlegroups.com
I have a Domain Object like this

public class MyObject
{
       public string name { get;set;}
       public IExtentionInfo extInfo {}
}

public class OneExtention : IExtentionInfo 
{
       public string yes { get;set;}
       public string no {get;set;}
}

Now I have a DTO like this:

public class ObjectDto
{
      public string name {get;set;}
      public string yes {get;set;}
      public string no {get;set;}
}

How to map that automatically but NOT by .ForMember One by one ? Thanks

Jimmy Bogard

未讀,
2015年4月24日 上午11:19:102015/4/24
收件者:automapper-users
Well....you can't. Let's say you have extInfo1 and extInfo2 properties on MyObject, how do I deal with collisions? The naming convention helps that.

Is this going out to JSON or something? Many times I'll put the external property names as serialization attributes on my DTOs.

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

回覆所有人
回覆作者
轉寄
0 則新訊息