Created
September 5, 2012 01:19
-
-
Save geethanga/3628835 to your computer and use it in GitHub Desktop.
Using Snowmaker for ID generation in Azure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static long GetUniqueId() | |
{ | |
if (_instance != null) | |
{ | |
return _instance.NextId("importID"); | |
} | |
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString")); | |
IOptimisticDataStore blobDataStore = new BlobOptimisticDataStore(storageAccount, AzureCloudStorageServices.GetStorageContainerName()); | |
_instance = new UniqueIdGenerator(blobDataStore); | |
return _instance.NextId("importID"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment