Running DbContext::SaveChanges causes all future queries to return still encrypted

Jun 8, 2014 at 2:05 AM
As mentioned in the title, each time I run the SaveChanges function on the DbContext object, any future queries ran with the dbcontext returns encrypted values. This also happens in the example source code if I add a SaveChanges call before the query which fetches orders for the given customer.

For now, I am having to re-initialise the dbContext as well as dbcontexthelper everytime I run SaveChanges, which I dont feel comfortable doing.

Any light on this behavior would be much appeciated.

Thanks
Coordinator
Jun 9, 2014 at 2:33 PM
You can only call SaveChanges once, and it needs to be after all of your reads and modifications to the in-memory objects are complete. Otherwise, you are probably ending up with double encrypted data.
Coordinator
Jun 9, 2014 at 3:40 PM
that means you cannot use the data that has been written.
I you need to use it after SaveChanges you need to keep your own local copy.

..tom's Windows Mail