예제 #1
0
        /// <summary>
        ///     Creates the valid properties selector and set it to the container.
        /// </summary>
        private void CreateValidPropertiesSelector()
        {
            var validPropertiesSelectors = new List <Func <PropertyInfo, bool> >
            {
                p => !p.PropertyType.GetTypeInfo().IsValueType,
                p => _registrationContainer.HasRegistration(p.PropertyType),
                p => p.GetIndexParameters().Length == 0,
                p => p.CanWrite
            };

            _validPropertiesSelector = validPropertiesSelectors.Aggregate((current, next) => p => current(p) && next(p));
        }
예제 #2
0
        private void BootStrappLightCore()
        {
            var typeOfArgumentCollector   = typeof(IArgumentCollector);
            var typeOfConstructorSelector = typeof(IConstructorSelector);

            if (!_registrationContainer.HasRegistration(typeOfArgumentCollector))
            {
                RegisterFactory <IArgumentCollector>(c => new ArgumentCollector()).ControlledBy <SingletonLifecycle>();
            }

            if (!_registrationContainer.HasRegistration(typeOfConstructorSelector))
            {
                RegisterFactory <IConstructorSelector>(c => new ConstructorSelector()).ControlledBy <SingletonLifecycle>();
            }
        }
 /// <summary>
 /// Checks whether an open generic type, taken from the closed type (contractType) is registered or not.
 /// (This makes possible to use open generic types and also closed generic types at once.
 /// </summary>
 /// <param name="contractType">The type of the contract.</param>
 /// <returns><value>true</value> if the open generic type is registered, otherwise <value>false</value>.</returns>
 private bool IsRegisteredOpenGeneric(Type contractType)
 {
     return(_registrationContainer.HasRegistration(contractType.GetGenericTypeDefinition()));
 }