I've had success so far utilizing the Entity Framework to modify data in a database.
However, I would want to have many applications interacting with the data at once (concurrent edition).
Is it possible to be informed when the information in the database changes?
I found a solution utilizing a DML trigger, but I'd want to know if there are any other options and, if so, which one is the best.
Perhaps my query wasn't clear enough, so let me give you an example.
You may want to consider using EF in your application. The smallest time feasible should be spent in the EF context:
Long lasting context is not a suitable option due to internal implementation (IdentityMap, UnitOfWork), and with short living context you don't want described behavior at all. Even in desktop applications, you need to utilize a context-per-form approach. You load data, give it to your user, and until that point, only the user may edit the data and press the save button. It is the job of the program to address concurrency concerns in some way (timestamp). Automatic data alteration is not a good concept because what if the user has already changed the data? Will you revoke his modifications?
More information on the implementation of
I can think of situations when client apps need to be notified when data changes. Real-time data may be shown that can only be read, such as stock trading information. However, in this situation, you need something more potent. It is not the case that a client calls an ORM to get data; rather, it is the case that a client subscribes to a service or middle tier that deals with data retrieval and quick change notification.
Polling may be used in basic instances when you simply need to update data in a semi-real time manner; your client will call the query once more after a short period of time and employ the StoreWins technique. Any notification technique must be implemented as a trigger, sql dependence, publish-subscribe pattern, or another method as it is beyond the scope of EF. You will only be able to respond to specific events and requery the data, even with notice.
Once again, if you want to use polling to limit data transmission, you'll need a service or intermediate tier that permits some amount of caching (you can also try WCF Data Services).
You may add a query at the database level.
Use a column in your table to indicate if a row has been modified since retrieval. If you only want to avoid overwriting changes, you may build update sprocs that check the timestamps and use them to save your entities. This might be verified by a trigger as you mention, by a monitoring system in your C# code, or if you just want to prevent overwriting changes.
You must determine how you wish to handle disagreements in advance regardless of the option you choose.