我正在尝试创建一个类似的审计函数:
public bool recordHeaderChanges(List<System.Data.Linq.ModifiedMemberInfo> mmi, string username)
{
var auditList = new List<data.tblVendorPackingSlipHeaderAudit>();
foreach (var mm in mmi)
{
var nAudit = new data.tblVendorPackingSlipHeaderAudit()
{
username = username,
dateTime = DateTime.Now,
field = mm.Member.Name,
OldVaue = mm.OriginalValue != null ? mm.OriginalValue.ToString() : null,
NewValue = mm.CurrentValue != null ? mm.CurrentValue.ToString() : null
};
auditList.Add(nAudit);
}
CustomClasses.DataTableHelper.BulkCopyToDatabase(auditList, "tblVendorPackingSlipHeaderAudit", db);
return true;
}
我这样调用它:
var changes = db.tblVendorPackingSlipHeaders.GetModifiedMembers(dbDoc).ToList();
recordHeaderChanges(changes, User.Identity.Name)
问题是当作为参数传递时,ModifiedMemberInfo对象中的所有内容都为null。
这甚至可能吗?