Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trouble with casting
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01608054
Message ID:
01608103
Vues:
24
>
>I think in this case you're right - as Rob pointed out, this code can easily create duplicates. You would have to have code on save which verifies that the new ID hasn't been used (and wrap it in some kind of locking mechanism anyway). I generally have a NewID() stored proc. I call through EF. It normally just grabs/stores an incrementing number but it's easy to modify if you run into cases where an operation could be cancelled (and this ID is "lost") but the business doesn't want missing #s in their sequence. It also cleanly handles the multi-update/locking issue.
>
>Definitely an interesting question from a C# perspective - I never would have expected the behavior differences between int/short.

Thanks for the feedback. At this point I'll bow out, don't want this to get heated. :)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform