3
数据库链接泛型列表我有一个类使用反射
public class UserInfo
{
public int ID { get; set; }
public string Name { get; set; }
public string Address { get; set; }
}
,我需要使数据库之间的联系,使用此代码:
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.HasRows)
{
}
}
上的所有线路使用反射数据库。
并将它们存储到一个通用的列表:
List<UserInfo> users = new List<UserInfo>();
我明白了!
为什么不使用[许多可用的ORM]之一(http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#.NET)而不是滚动自己的? – GolfWolf
这是你的意思吗? http://stackoverflow.com/questions/12662318/how-to-convert-datatable-to-listt-using-reflections – Winks
我明白了!谢谢 ! – SanRyu