Ejemplo n.º 1
0
        public RegistrationEntry Register(Type interfaceType, Func <object> implementationFn)
        {
            if (interfaceType == null)
            {
                throw new ArgumentNullException(nameof(interfaceType));
            }
            if (implementationFn == null)
            {
                throw new ArgumentNullException(nameof(implementationFn));
            }
            var regEntry = new RegistrationEntry
            {
                InterfaceType = interfaceType,
                ImplementationInstanceFunc = implementationFn
            };

            _registrationsCache[interfaceType] = regEntry;
            return(regEntry);
        }
Ejemplo n.º 2
0
        public RegistrationEntry Register(Type interfaceType, Type implementationType = null)
        {
            if (interfaceType == null)
            {
                throw new ArgumentNullException(nameof(interfaceType));
            }
            if (implementationType == null)
            {
                implementationType = interfaceType;
            }
            var regEntry = new RegistrationEntry
            {
                InterfaceType      = interfaceType,
                ImplementationType = implementationType
            };

            _registrationsCache[interfaceType] = regEntry;
            return(regEntry);
        }