Apologies if this is a dumb fool question, but I'm tired today and google isn't helping. This must be a common problem, but nothing I've found answers the question.
Whenever I've made use of Entity Framework in clickonce desktop applications, I've suffered a bit with the "entity object cannot be referenced by multiple instances of IEntityChangeTracker" error. This arises when multiple versions of the same database object are updated by different versions of the context.
On a web project, it's easy to bypass this issue by sending all the Db calls through some sort of singleton pattern on the server. If you're farming out a lot of Db update/insert calls to a service, you can do the same.
But what if you had a distributed application (e.g. WPF via clickonce) which potentially had a lot of users connecting to the database. Each user has their own install of the code, so even if you separate out the business logic from the Db logic, each user will still have their own copy of the context.
Is there any sort of pattern or technique that would allow inserts/updates direct from the application while avoiding the "multiple contexts" problem? Or is using something like a Windows service the only way to achieve this?