When i run 2 instances of my application in front of a comon SQL SERVER DB i have the following behavior:
each time an object is added or removed, the other app sees it
each time an update is done to the object, the other does not see it until i close and open the application
I’m working with WPF bindings and EF4
Any clue ?
thanks
Joghn
I think you are reusing context, don’t you? EF will not load changes automatically. If you run the query, then modify data in the database and then run the same query again you will get the same result as in the first query, only new records will be added. That is how EF behaves and this behavior is very important in ORM tools. If you want to force context to reload data and throw away the state you have in the application (= all unsaved changes will be lost) you must run the query with
MergeOption.OverwriteChanges(example here) or callRefreshmethod withRefreshMode.StoreWins.