title: Automapper map few source object property to destination object and few to its complex child object property
body: <pre><code>public class Restaurant 
  {
          public int RestaurantId { get; set; }
          public string Name { get; set; }
          public string Description { get; set; }
          public string Slug { get; set; }
          public bool Active { get; set; }
          public string Address1 { get; set; }
          public string Address2 { get; set; }
          public string ZipCode { get; set; }
          public string City { get; set; }
          public decimal? Lat { get; set; }
          public decimal? Long { get; set; }
  }
  
  public class RestaurantInfo 
  {
          public int RestaurantId { get; set; }
          public string Name { get; set; }
          public string Description { get; set; }
          public string Slug { get; set; }
          public bool Active { get; set; }
          public Address Address { get; set; }
  }
  
  public class Address
  {
          public string Address1 { get; set; }
          public string Address2 { get; set; }
          public string ZipCode { get; set; }
          public string City { get; set; }
          public decimal? Lat { get; set; }
          public decimal? Long { get; set; }
  }
  </code></pre>
  
  <p><strong>Auto Mapper</strong></p>
  
  <pre><code>public class AutoMapperProfile : Profile
      {
          public AutoMapperProfile()
          {
              CreateMap&lt;Restaurant, RestaurantInfo&gt;();
  
              CreateMap&lt;Restaurant, Address&gt;();
          }
      }
  
  public RestaurantInfo GetRestaurantById(IMapper mapper)
      {
  
          var restaurant = new Restaurant
              {   
                  RestaurantId = 1,
                  Name = "Blueline",
                  Slug =  "Blueline",
                  Active = true,
                  Address1 = "XYZ",
                  Address2 = "PQR"
              };
  
          return mapper.Map&lt;Restaurant&gt;(restaurantInfo);    
      }
  </code></pre>
  
  <p>My source class is Restaurant and Destination class is RestaurantInfo. Auto mapper is converting Restaurant back into RestaurantInfo, but issue is Address property of RestaurantInfo is not getting initialized with all address related properties of Restaurant. I think my mapping code is not correct. Suggest me correct mapping for above issue.</p>