【发布时间】:2016-08-14 18:49:38
【问题描述】:
我想使用自动映射器将我的数据表映射到列表。我尝试使用下面的代码,但它不起作用,我遇到了错误。
var data = GetDataTableResult();
var result = Mapper.Map<IDataReader, IList<RollCall>(data.CreateDataReader());
public class RollCall
{
public long Id { get; set; }
public string CreationUserId { get; set; }
public DateTime CreationTs { get; set; }
public string LastChangeUserId { get; set; }
public DateTime LastChangeTs { get; set; }
public byte StatusType { get; set; }
public DateTime EntryTs { get; set; }
public int ClientId { get; set; }
public int RollcallId { get; set; }
public int VehicleId { get; set; }
public double Quantity { get; set; }
public double OpeningOdo { get; set; }
public double ClosingOdo { get; set; }
public int OrderId { get; set; }
}
缺少类型映射配置或不支持的映射。
映射类型:
IDataReader -> IList1
System.Data.IDataReader -> System.Collections.Generic.IList1[[SampleDemo.RollCall, SampleDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
目的地路径:
列表`1
源值:
System.Data.DataTableReader
【问题讨论】:
标签: c# datatable automapper