I am using EF with Oracle..
I have a test that will run this bit of code
using (var ctx = new Entities())
{
ctx.SOMEOBJECTSESSIONs.Add(
new SOMEOBJECTSESSION()
{
SOMEOBJECTSESSIONID = 0,
SOMEOBJECTSESSIONIDHASH = hash,
DEVICEDESC = "some device",
OPERATINGSYSTEMDESC = "Microsoft Windows NT 6.1.7601 Service Pack 1",
BROWSERDESC = "Chrome27",
IPADDRESS = "123.132.123.132",
SOMEOBJECTSESSIONSTATUSID = 9999999999,
CREATEDBYSOMEOBJECTID = 9999999999,
CREATEDDATE = DateTime.Now,
UPDATEDBYSOMEOBJECTID = 9999999999,
UPDATEDDATE = DateTime.Now
}
);
ctx.SaveChanges()
}
Using this I add a record to the database.. I then went into the database and manually deleted that record..
When I try and run this test again, the call to SaveChanges dies, just sits there.. Now If I do a
var tmp = ctx.SOMEOBJECTSESSIONs.Count();
I get back a count that is one more than what is in the database.. Which to me suggests EF still has a hook locally to the record I deleted..
I have read numerous articles about refreshing context(didn't work). I have cleared the "Local"
ctx.SOMEOBJECTSESSIONs.Local.Clear()
which also did not work..
I would have thought that the fact I am spawning up a new Entities connection it should be getting the data from the database..
How do I fix this? What am I doing wrong?
Cheers, J