我使用AutoMapper的第一天,我正在尝试使用数据库表映射一个对象,但它不是映射而我的列表是空的,这就是我的尝试,
public static void MapFromDB()
{
someDataAccess da = new someDataAccess();
someSolution.DataAccess.Clients.Fruit_CrateDataTable dt = da.GetFruitCratesTable(999);
List<FruitCrate> a = new List<FruitCrate>();
Mapper.AssertConfigurationIsValid();
Mapper.DynamicMap(dt, a);
Console.WriteLine("Done");
}
public class FruitCrate
{
public int ID;
public int DeliveryID;
public int DriverID;
public int NumberOfFruits;
public int RottenFruits;
public int BadCats;
public string CatsName;
public string CatsDescription;
public string CatDadName;
}
我期待什么
我希望获得包含DataTable中列表项的List