Esempio n. 1
0
 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>());
 }
Esempio n. 2
0
        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));
            }
        }
Esempio n. 3
0
 public AzureModule(ILifetimeProvider lifetimeProvider)
 {
     _lifetimeProvider = lifetimeProvider;
 }
Esempio n. 4
0
 public AzureModule(ILifetimeProvider lifetimeProvider)
 {
     _lifetimeProvider = lifetimeProvider;
 }
Esempio n. 5
0
 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;
 }
Esempio n. 8
0
 public SqlModule(ILifetimeProvider lifetimeProvider)
 {
     _lifetimeProvider = lifetimeProvider;
     _connectionString = ConfigurationManager.ConnectionStrings["Hadouken"].ConnectionString;
 }