鉴于我正在实现只读UI,如何为Shop
创建一个ClassMap:
public class Shop {
public int Id { get; set; }
public City City { get; set; }
}
public class City {
public string Name { get; set; }
public string CountryCode { get; set; }
}
Shops的DB界面是一个包含3列的视图(ShopId,CityName,CountryCode)。我希望能做到这样的事情:
public sealed class ShopMap : ClassMap<Shop> {
public ShopMap()
{
Table("Shop");
Id(x => x.Id, "ShopId");
Map(x => x.City.Name, "CityName");
Map(x => x.City.CountryCode, "CountryCode");
}
}
是否会自动实例化Shop.City?