WCF数据服务异常

WCF数据服务异常,wcf,wcf-data-services,Wcf,Wcf Data Services,我正在使用ADO.Net数据服务WCF数据服务在C#.Net上工作 当我到达context.SetLink()时,我尝试将一条记录更新到关系表中,我得到了异常(“上下文当前没有跟踪实体”)。我不知道如何解决这个问题。下面指定了我的代码 LogNote dbLogNote =logNote; LogSubSession dbLogSubSession = (from p in context.LogSubSession where

我正在使用ADO.Net数据服务WCF数据服务在C#.Net上工作

当我到达
context.SetLink()
时,我尝试将一条记录更新到关系表中,我得到了
异常(“上下文当前没有跟踪实体”)
。我不知道如何解决这个问题。下面指定了我的代码

LogNote dbLogNote =logNote;
LogSubSession dbLogSubSession = (from p in context.LogSubSession
                                 where p.UID == logNote.SubSessionId
                                 select p).First<LogSubSession>()
                                 as LogSubSession;
context.AddToLogNote(dbLogNote);
dbLogNote.LogSubSession = dbLogSubSession;
context.SetLink(dbLogNote, "LogSubSession", dbLogSubSession);
context.SaveChanges();
LogNote dbLogNote=LogNote;
LogSubSession dbLogSubSession=(来自context.LogSubSession中的p
其中p.UID==logNote.SubSessionId
选择p.First()
作为对数分段;
AddToLogNote(dbLogNote);
dbLogNote.LogSubSession=dbLogSubSession;
SetLink(dbLogNote,“LogSubSession”,dbLogSubSession);
SaveChanges();
这里,
LogSubSession
是一个主表,
LogNote
是一个外部表。我正在根据主键表将数据更新到外部表中


感谢

尝试使用AttachLink()让实体知道开始跟踪链接。

ADO.NET数据服务几个月前被重命名为WCF数据服务。还有:请提供更多信息!这是LINQtoSQL作为数据库层,还是LINQtoEntities?