Skip to content

Instantly share code, notes, and snippets.

@dsarfati
Created April 5, 2016 16:49
Show Gist options
  • Save dsarfati/64b681e5300833a2bc50831152824957 to your computer and use it in GitHub Desktop.
Save dsarfati/64b681e5300833a2bc50831152824957 to your computer and use it in GitHub Desktop.
Orleans Cluster Singleton
public static class GrainExtensions
{
public static T GetGrain<T>(this IGrainFactory grainFactory) where T : IGrainWithSingletonKey
{
return grainFactory.GetGrain<T>(Guid.Empty);
}
}
/// <summary>
/// Marker interface for cluster level singleton
/// </summary>
public interface IGrainWithSingletonKey : IGrainWithGuidKey
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment