我用Automapper將我的對象映射到dtos。Automapper null屬性
public class OrderItem : BaseDomain
{
public virtual Version Version { get; set; }
public virtual int Quantity { get; set; }
}
[DataContract]
[Serializable]
public class OrderItemDTO
{
[DataMember]
public int Id { get; set; }
[DataMember]
public string Guid { get; set; }
[DataMember]
public virtual int? VersionId { get; set; }
[DataMember]
public virtual string VersionName { get; set; }
[DataMember]
public virtual int Quantity { get; set; }
}
所以當我有OrderItem的與空的版本,我終於找到一個例外:
Mapper.Map<OrderItem, OrderItemDTO>(item)
Missing type map configuration or unsupported mapping.
您可以將代碼發佈到您創建映射的位置嗎? – 2010-06-21 12:31:50