Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using IDisposable
Message
 
À
21/11/2008 17:20:27
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01363570
Message ID:
01363628
Vues:
11
>
>This goes back to my file based queue. If I save a record and then can't delete it right away for some reason it causes a constraint exception if it tries to get saved again. From there on the queue is blocked because of a file that is already saved and didn't get deleted. Soo.. What I am doing for right now is putting the files that are saved but not deleted into a List collection. The next time I delete files I attempt to also delete the files in this list. When the class is shut down and the List object goes away if there are still files in the list then I need to persist this list. I am serializing that list to an xml and deserializing it on startup. This serialization needs to happen or the list of files that have already been saved and not deleted is lost. Unfortunately my means of determining the root cause of constraint exception is not good or I would just wipe the file out when that occurs. It is certainly possible for me to pre-test each file to determine if it already exists in the data before trying to save it, but that will be expensive in performance. This data is being saved via WCF to a sql server on a non reliable connection.

Serialize the "files to delete" list on each timer event (or even after adding a new item to the list) - I wouldn't wait until shutdown if you're really worried about it. When you run through the list later just check to see if the file exists or not; if not, just move on.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform