Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locking mechanism on data dictionary update
Message
De
23/03/2011 12:39:00
 
 
À
23/03/2011 12:18:39
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01504666
Message ID:
01504692
Vues:
36
>It sounds like updating the data dictionary is not done very often. I assume that all access/updates to the data dictionary is done through this Data class that you mentioned, so you should be able to control it all from there. Something like this might be the way to handle this (sorry, this is going to be in C#, and also un-tested off the top of my head):
>
>
>// in your method that updates the data dictionary
>this.UpdatingDD = true;
>lock (lockObjDD)
>{
>    // do the updating stuff here
>}
>this.UpdatingDD = false;
>
>// in your method that needs to use the data dictionary
>if (this.UpdatingDD == false)
>{
>    lock (lockObjDD)
>    {
>        // do your data dictionary stuff here
>    }
>}
>
>
>Unfortunately, you probably still have to do the "expensive" lock when you're accessing the data dictionary to prevent the situation where UpdatingDD is false, but a split second later it might be true, so you'll need to lock.

The main problem is that I am using a .Remove() approach and .Add() next to update an entry in the NameObjectCollectionBase. Instead of doing that, maybe I could just update the entry instead. However, I am not sure if the NameObjectCollectionBase supports the update of an entry once it is created. If that could work, then, this would resolve the issue.

Do you know if it is possible to update an entry in a NameObjectCollectionBase collection?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform