Beispiel #1
0
        private void RegisterBaseOnLifetimeScope(Type interfaceType, Type implementerType)
        {
            var regInfo       = implementerType.GetRegistrationInfoFromCustomAttribues();
            var lifeTimeScope = regInfo.Item1;
            var name          = regInfo.Item2;

            switch (lifeTimeScope)
            {
            case LifetimeScopeType.SingleInstance:
                _registrator.RegisterAsSingleInstance(interfaceType, implementerType, name);
                break;

            case LifetimeScopeType.InstancePerLifetimeScope:
                _registrator.RegisterAsPerLifetimeScope(interfaceType, implementerType, name);
                break;

            case LifetimeScopeType.InstancePerRequest:
                _registrator.RegisterAsPerRequest(interfaceType, implementerType, name);
                break;

            case LifetimeScopeType.InstancePerDependency:
            default:
                _registrator.Register(interfaceType, implementerType, name);
                break;
            }
        }