UniqueIdGenerator
UniqueIdGenerator copied to clipboard
C# implementation of Twitter's Snowflake
Might not be the best solution, but since I am using smaller sequence sizes and this could add significant os calls and context switches, it might be prudent to do...
This lib has really cool hidden features. After you have generated an ID, you can convert the ID into its parts: - string Bits - TimeSpan Time - short GeneratorId...
NextLong can return just long type since sql server don't support unsigned bigint type.
I like this implementation. I've seen some that use a Stopwatch instead of DateTime.Now because it's more accurate. That is the only possible improvement I can think of.