Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 17, 2012 09:52 AM by AidyF
Aug 17, 2012 06:54 AM|LINK
Asslam-o-Alaikum and Hi to all of you respected Members..
I have a service created in .net FW 3.5 which is large applications means that many users use it at a same time, in industry term it supports multiple sequence number generated at a one time
Generating a random is not a big issue, problem is getting the last used number.
Now i have two options either i used C# Sequnce generation method or SQL Server Sequence number generator
C# Sequence Number method would be fail if service restart, SQL Server Sequence Number method make the service slow.
Please advice what would be a great approach for Sequence number generator in a Large Application which supports multiple transactions......
Aug 17, 2012 09:52 AM|LINK
Simplest would be something like
public static class Sequence
private static object thisLock = new object();
private static int sequence;
sequence = 0;
public static int Next()
int x = Sequence.Next();