在Entity Framework 4.0中保存数据时出现异常

时间:2012-07-13 14:19:06

标签: asp.net entity-framework c#-4.0

例外

  

无法更新EntitySet'Audit_Log',因为它有一个   定义查询并且没有元素存在于    元素支持当前   操作

我正在那样使用

Audit_LogEntity ale = new Audit_LogEntity();`

MemoryStream ms = new MemoryStream();
NetDataContractSerializer serialize = new NetDataContractSerializer();

serialize.Serialize(ms, obj);            

Audit_Log al = new Audit_Log();
al.Object = ms.ToArray();
al.DateTime = DateTime.Now;
al.Page_Name = pagename;
al.Pageid = uniqueid;
al.UserId = userid;

ale.AddToAudit_Log(al);

ale.SaveChanges();

0 个答案:

没有答案