Skip to content

Instantly share code, notes, and snippets.

@david-mills
Created June 8, 2014 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-mills/fc9e6e506adefd7cf50b to your computer and use it in GitHub Desktop.
Save david-mills/fc9e6e506adefd7cf50b to your computer and use it in GitHub Desktop.
namespace Foo.Bar
{
using Castle.MicroKernel.Lifestyle;
using Microsoft.WindowsAzure.ServiceRuntime;
public class AzureSingletonLifestyleManager : SingletonLifestyleManager
{
public AzureSingletonLifestyleManager()
{
RoleEnvironment.Changed += this.RoleEnvironment_Changed;
}
private void RoleEnvironment_Changed(object sender, RoleEnvironmentChangedEventArgs e)
{
this.Dispose();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment