views:

109

answers:

0

Hi,

I am working on C#.Net with ADO.NET Dataservice WCF Data Services.

I try to update one record to relational table, when I reach context.SetLink() I am getting exception("The context is not currently tracking the entity"). I don't know how to solve this problem. My code is specified below.

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();

Here LogSubSession is a primary table and LogNote is a foreign table. I am updating data into foreign table based on primary key table.

Thanks