Skip to content

Instantly share code, notes, and snippets.

View geethanga's full-sized avatar

Geethanga Amarasinghe geethanga

View GitHub Profile
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);
@geethanga
geethanga / IdentityProvider.cs
Created September 5, 2012 01:19
Using Snowmaker for ID generation in Azure
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");
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">