Esempio n. 1
0
        public InstanceFactory(Type registerType, Type registerImplementation, object instance)
        {
            if (!DependencyContainer.IsValidAssignment(registerType, registerImplementation))
            {
                throw new DependencyContainerRegistrationException(registerImplementation, "InstanceFactory", true);
            }

            _registerType           = registerType;
            _registerImplementation = registerImplementation;
            _instance = instance;
        }
Esempio n. 2
0
        public SingletonFactory(Type registerType, Type registerImplementation)
        {
            if (registerImplementation.IsAbstract() || registerImplementation.IsInterface())
            {
                throw new DependencyContainerRegistrationException(registerImplementation, nameof(SingletonFactory), true);
            }

            if (!DependencyContainer.IsValidAssignment(registerType, registerImplementation))
            {
                throw new DependencyContainerRegistrationException(registerImplementation, nameof(SingletonFactory), true);
            }

            _registerType           = registerType;
            _registerImplementation = registerImplementation;
        }
Esempio n. 3
0
        public MultiInstanceFactory(Type registerType, Type registerImplementation)
        {
            if (registerImplementation.IsAbstract() || registerImplementation.IsInterface())
            {
                throw new DependencyContainerRegistrationException(registerImplementation,
                                                                   "MultiInstanceFactory",
                                                                   true);
            }

            if (!DependencyContainer.IsValidAssignment(registerType, registerImplementation))
            {
                throw new DependencyContainerRegistrationException(registerImplementation,
                                                                   "MultiInstanceFactory",
                                                                   true);
            }

            _registerType           = registerType;
            _registerImplementation = registerImplementation;
        }