Accessing Static Lists in an ASP.NET Object Framework

Last post 06-27-2008 8:53 AM by AgeGould. 0 replies.

Sort Posts:

  • Accessing Static Lists in an ASP.NET Object Framework

    06-27-2008, 8:53 AM
    • Loading...
    • AgeGould
    • Joined on 01-04-2008, 12:12 PM
    • Posts 13

    Hi.

    I am writing an object framework that uses in memory static Lists to maintain information.

    These are synchrinised with SQL server for obvious reasons.

    My issue is this:-

    How do I allow multiple concurrent instances of a Web page to search this list (i.e. iterate over it), when there is a chance that the List is being updated.

    The obvious thing - which I have implemented is the use of the Lock{SyncRoot) statement, which works but this prevents concurrent searches of the list.(If you have to lock the List to modify it, you also have to lock it to iterate over it) - which removes the concurrency.

    To update the list, you have to Lock it, but you can't iterate over the List without locking it, otherwise an exception is raised if the List changes. Hence Concurrent Searching is not possible.

    One idea I have is not to Lock the List for Searches, only for updates, and simply try the search again if an exception is raised and caught. This way Searching can remain concurrent. 

    Any thoughts?

     

Page 1 of 1 (1 items)
Microsoft Communities
Page view counter