G
Guest
I am designing / implementing a thick client application in C# which will draw in a large quantity of real time data from various external feeds (Tib and similar mechanisms)
cache data in an in memory database and display data in a variety of configurable controls on an MDI front end
A key objective of the design of the application is enabling the easy use in front end of off the shelf .Net Grid / Tree / other controls and an obvious way to do this is to suppor
data being provided to them using ADO .Net recordset classes. Due to the high volume of update going on into the system it is not desirable to bind these recordsets directly t
the in memory database and instead I am planning that for each ADO recordset (each can literally be thought of as a single table of data) required for front end dispay, there will
be two ADO Recordsets within the application, one will be directly bound to a UI Control refreshed periodically, the second will be maintained in real time by using an observer pattern on the real tim
database, the UI control bound record set will periodically refesh itself by copying changed rows from the real time recordset
Now For the question
For the recordset being updated by real time data I need to implement some locking as data can be written / created / deleted from mulitple threads and read by another thread.
So I required a writer lock on the data table as a whole for creates and deletes of rows, a read lock on the table and a write lock at row level for row updates and a reader lock on the table and at row level for row level writes. From looking through ADO .Net documentation and web sites the only way I can see of doing this is to contain the recordset (essentially the table), in a class with CreateRow, DeleteRow, GetRowForUpdate, and GetRowForRead methods, and contain each row in a class implenting a Read / Write methods, and lock using the ReaderWriterLock class supplied in .Net, the table containing class having a ReaderWriterLock object, and each row object having its own ReaderWriterLock object
This solution however is ineloquent, so is anyone aware of built in mechanism in ADO .Net to support what I am trying to do
cache data in an in memory database and display data in a variety of configurable controls on an MDI front end
A key objective of the design of the application is enabling the easy use in front end of off the shelf .Net Grid / Tree / other controls and an obvious way to do this is to suppor
data being provided to them using ADO .Net recordset classes. Due to the high volume of update going on into the system it is not desirable to bind these recordsets directly t
the in memory database and instead I am planning that for each ADO recordset (each can literally be thought of as a single table of data) required for front end dispay, there will
be two ADO Recordsets within the application, one will be directly bound to a UI Control refreshed periodically, the second will be maintained in real time by using an observer pattern on the real tim
database, the UI control bound record set will periodically refesh itself by copying changed rows from the real time recordset
Now For the question
For the recordset being updated by real time data I need to implement some locking as data can be written / created / deleted from mulitple threads and read by another thread.
So I required a writer lock on the data table as a whole for creates and deletes of rows, a read lock on the table and a write lock at row level for row updates and a reader lock on the table and at row level for row level writes. From looking through ADO .Net documentation and web sites the only way I can see of doing this is to contain the recordset (essentially the table), in a class with CreateRow, DeleteRow, GetRowForUpdate, and GetRowForRead methods, and contain each row in a class implenting a Read / Write methods, and lock using the ReaderWriterLock class supplied in .Net, the table containing class having a ReaderWriterLock object, and each row object having its own ReaderWriterLock object
This solution however is ineloquent, so is anyone aware of built in mechanism in ADO .Net to support what I am trying to do