0
我正在创建一个方法,它将循环实体对象上的属性列表来检查每个对象并在其中粘贴一些虚拟数据。这可能吗?我尝试低于但我卡住...(评论细节我不能工作,如何做)......如何获得EntityObject类型的类型并将其与数据一起填充?
private static void SetAllNonNullableProperties(EntityObject airport, string uniqueMessage)
{
Type t = airport.GetType();
PropertyInfo[] props = t.GetProperties();
foreach (var prop in props)
{
//1) How do I see if this property is nullable?
//2) How do I tell the type so that I can stick a string/bool/datetime in it with dummy data?
}
}
只是好奇,你为什么不以实体的构造themsel定义默认值VES? – 2012-07-31 21:17:34