Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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,

asked 03 Dec '14, 14:05

vdcey's gravatar image

vdcey
674293441
accept rate: 33%


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.

I have tried several things with only moderate success.

Can we see the code that you have already tried?

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.

If you're referring to validation, this is a known limitation of Entity Framework - you need to explicitly validate deleted entries:

permanent link

answered 05 Dec '14, 15:17

Jeff%20Albion's gravatar image

Jeff Albion
10.8k171175
accept rate: 25%

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
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×371
×69

question asked: 03 Dec '14, 14:05

question was seen: 3,951 times

last updated: 08 Dec '14, 09:18