FlakeGen.IdGuidGenerator

FlakeGen.IdGuidGenerator generates directly sortable GUID ids (128-bit).

The generator can get it's unique number by specifying 48-bit id which gives 281,474,976,710,656 unique generators. One of the scenarios is to use MAC address of the system hosting a generator. A sample code can be found here.

Example:

...
namespace FlakeGenConsole
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var idGuidGenerator = new IdGuidGenerator();
            Console.WriteLine("1: {0}", idGuidGenerator.GenerateId());

            var idGuidGenerator2 = new IdGuidGenerator(
                new byte[] {123, 123, 11, 19, 0, 1});
            Console.WriteLine("2: {0}", idGuidGenerator2.GenerateId());
        }
    }
}

Output:

1: 0004cdea-3241-e191-0000-000000000000
2: 0004cdea-3241-f901-0100-130b7b7b0000

Last edited Nov 8, 2012 at 11:33 AM by tompawlak, version 3

Comments

No comments yet.