0

私はエンティティを持っています:

public class Person
 {
   //properties
   public virtual State State { get; set; }
 }

 public class State
 {
       //properties
       public int StateId { get; set; }
       public string StateName { get; set; }
       public virtual Address Address{ get; set; }
 }

public class Address
 {
       //properties
       public int AddressId { get; set; }
       public string City{ get; set; }
       public int PostalCode { get; set; }       
 }

そして、PersonDetails というフラット化された DTO があります。

public class PersonDetails
 {
       //properties
       public string City { get; set; }
       public string StateName { get; set; }
       public int PostalCode { get; set; }       
 }

マッピングを行うと機能しますが、Person エンティティの新しい州と住所が作成されます。

AutoMapper を使用して から にマップするにはどうすればよいPersonDetailsですPersonEntityか?

4

0 に答える 0