internal static Lifetime <T> CreateLifetime <T>(ILifetimeProvider provider) { if (provider == null) { provider = GetDefaultLifetimeProvider(typeof(T)); return(provider.GetLifetime <T>()); } VerifyLifetime(provider, typeof(T)); return(provider.GetLifetime <T>()); }
static void VerifyLifetime(ILifetimeProvider provider, Type instanceType) { if (!typeof(IDisposable).IsAssignableFrom(instanceType)) { return; } var lifetimeType = provider.GetType(); if (lifetimeType != typeof(ScopeLifetimeProvider) && lifetimeType != typeof(ContainerLifetimeProvider)) { throw new InvalidLifetimeScopeException(string.Format("The type [{0}] implements the [System.IDisposable], which should be registered in scope or container life time!", instanceType.FullName)); } }
public AzureModule(ILifetimeProvider lifetimeProvider) { _lifetimeProvider = lifetimeProvider; }
public AzureModule(ILifetimeProvider lifetimeProvider) { _lifetimeProvider = lifetimeProvider; }
public SqlModule(ILifetimeProvider lifetimeProvider) { _lifetimeProvider = lifetimeProvider; _connectionString = ConfigurationManager.ConnectionStrings["Hadouken"].ConnectionString; }
public IMatadataApi In(ILifetimeProvider lifetimeProvider) { _provider.LifetimeProvider = lifetimeProvider; return(this); }
public void In(ILifetimeProvider lifetimeProvider) { _registrationData.LifetimeProvider = lifetimeProvider; }
public SqlModule(ILifetimeProvider lifetimeProvider) { _lifetimeProvider = lifetimeProvider; _connectionString = ConfigurationManager.ConnectionStrings["Hadouken"].ConnectionString; }