i have to provide a unique number to clients of my app. It's an invoice number, so it has to be unique, and thread safe off course.
In the past i created a singleton and used a lock statement: during the lock i would go to the database and get a new number and then release the lock.
Something is telling me that this could also be done in SqlServer, but in SqlServer i assume i also have to create some kind of lock because the sql code (stored procedure) can be executed in parallel also i guess.
So when i have to provide a lock anyway, does it make a difference wether i do it in c# or in Sql?