Well supported ORM for long term context
The next question is here .
With most ORMs, when you run a query against an existing context, it does not return data that has changed since the objects were first returned from the database. It issues a query to the DB, but any changes made to the DB are not returned because the context doesn't want to stomp on your objects (for a discussion of this behavior in Linq to SQL, see here ). This is fine for short-lived contexts using the Unit of Work pattern, but not so good if you are using long-lived contexts.
I tried Linq to SQL and Entity Framework, both frameworks provide an update method that allows you to specify an enum argument to replace an existing object in the context, but that won't collect new records (at least not without additional query) and more importantly, will not delete objects for records that have been deleted from the database.
I know I can just give up the context and existing objects, but I don't want to do this because the objects are attached to other elements in the application.
Is there an ORM that has the ability to update objects with the latest data for the DB, add objects for newly created objects, and delete objects for records that have been deleted from the DB, ideally in an efficient manner (i.e. using MS SQL rowversion).
a source to share
I'm not sure, but it looks like you want something similar to the behavior of DataObjects.Net. Their entities are long-lived session-related objects that store data in a transactional state. When you open a new transaction and read the persistent property of existing objects, they will automatically retrieve it from the database (this also applies to the properties of the EntitySet).
Of course, you have to run complex queries for every transaction to keep the query results in real state, but I think this can be automated easily.
a source to share
Check out this ORM: " http://entityorm.uuuq.com "
Do you have on the site:
- A basic example of how this works.
- Complete documentation and example in pdf format;
- Forum
- Supported DBs (unlimited as you can make your own drivers).