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