public void SetMaterial(Material model)
{
Type t = model.GetType();
PropertyInfo[] fieldInfos = t.GetProperties();
List<string> defaultFields = new List<string>()
{
//"IsDeleted",
//"DeleterId",
//"DeletionTime",
"LastModificationTime",
"LastModifierId",
"LastModifier",
"CreationTime",
"CreatorId",
"Creator",
"ApproveTime",
"ApproverId",
"ExtraProperties",
"UnApproveTime",
"UnApproverId",
"CloseTime",
"CloserId",
"UnCloseTime",
"UnCloserId",
"ConcurrencyStamp",
"Id",
"TextureModel",
"BrandModel",
"Unit",
"Category",
"ChargeUnit",
"MultiCompany",
};
foreach (var field in fieldInfos)
{
if (defaultFields.Contains(field.Name))
continue;
//调用InvokeMember提取当前属性值
object myvalue = t.InvokeMember(field.Name, BindingFlags.GetProperty, null, model, null);
//将提取出来的属性值赋值到当前对象
t.InvokeMember(field.Name, BindingFlags.SetProperty, null, this, new object[] { myvalue });
}
}