Question : .NET Database applications with objects populated from the same database record

Hi,

I am developing a .net database application that will be used by many users simultaneously. There is a large possibility that two or more instances of this application will have an object (of the same class) that has been populated from the same database record.

For example, both applications may have an separate instances of the Person object for person ID 1234. I am currently solving the concurrency issue by giving the user options if the RowID in the database has changed since the Person object was loaded when the user modifies the object. Using this method, the user can't see any changes to the object until they try to commit a change themselves.

Is there any better way in .NET to notify applications that changes have been made to its objects (or any best practice pattern). Also, is there any way that the two applications can refer to the same instance of the Person object (maybe by keeping the Person repository and other common domain objects on a server).

Thanks very much for your help.

Answer : .NET Database applications with objects populated from the same database record

If I understand the locking mechanism correctly the pessimistic lock will prevent user 2 making changes as soon as user 1 starts making changes.  Yes - user 2 doesn't see changes as they are made, however they do get a response indicating that changes are currently being made and they can not start their changes until user 1 finishes.  (Obviously this doesn't apply if you disconnect the recordset from the server after loading).
Random Solutions  
 
programming4us programming4us