Hi, Has anyone experience here with Entity Framework with SQL Anywhere and Mobilink? The thing with Entity Framework is that the DBContext is not updated when Mobilink synchronization happens, since the data change happens outside the DBContext, so it is not aware of it. I have tried several things with only moderate success. The best I can do is to refresh the DBContext, but this results in only adding new records to the context. Deleted records are not removed. Any way on keeping the DBContext after synchronization? Thanks, |
This is really an Entity Framework question at its core. If you remove the concepts of "MobiLink" and "SQL Anywhere" from your question, you will likely have better luck finding about "How do I refresh a DBContext in Entity Framework?":
Each entity you're working on should have the DbEntityEntry.Reload Method called on it - here's an example: Remember that the MobiLink server is essentially 'just another ODBC client' and is really just more concurrency happening against your database - the same behaviour could also happen with any other database client while working with Entity Framework.
Can we see the code that you have already tried?
If you're referring to validation, this is a known limitation of Entity Framework - you need to explicitly validate deleted entries: Thanks for the answer. I've tried pretty much everything in this thread: http://stackoverflow.com/questions/5221314/refresh-entity-instance-with-dbcontext/18251442#comment42710332_18251442 I'll take a look at your suggestions. Regards,
(08 Dec '14, 09:18)
vdcey
|