【发布时间】:2015-04-05 19:47:11
【问题描述】:
我有一个定义一些映射的方法如下:
/// <summary>
/// Mapping definitions for domain entities to database entities
/// </summary>
private static void DefineMappingDomainEntitiesToDatabase()
{
// SellerListing
Mapper.CreateMap<SellerListing, Data.SellerListing>();
// ListingShippingCost
Mapper.CreateMap<ListingShippingCost, Data.ListingShippingCost>();
}
SellerListing 实体定义包含以下属性
List<ListingShippingCost> ListingShippingCostList { get; set; }
当我调用Mapper.AssertConfigurationIsValid(); 时,我收到以下错误:
SellerListing -> SellerListing (Destination member list)
MyApp.Entities.SellerListing -> MyApp.Data.SellerListing (Destination member list)
Unmapped properties:
ListingShippingCost
所以它告诉我,我没有 ListShippingCost 的映射,尽管我确实有 ListingShippingCost 的映射定义,如您所见。显然我需要为这个映射在我的 SellerListing 定义中添加一些东西,但我不确定是什么。
【问题讨论】:
标签: c# automapper