Exemple #1
0
        /// <summary>
        /// Add policies to the <paramref name="policies"/> to configure the
        /// container to call this constructor with the appropriate parameter values.
        /// </summary>
        /// <param name="typeToCreate">Type to register.</param>
        /// <param name="name">Name used to resolve the type object.</param>
        /// <param name="policies">Policy list to add policies to.</param>
        public override void AddPolicies(Type typeToCreate, string name, IPolicyList policies)
        {
            MethodInfo methodInfo = FindMethod(typeToCreate);

            ValidateMethodCanBeInjected(methodInfo, typeToCreate);

            SpecifiedMethodsSelectorPolicy selector =
                GetSelectorPolicy(policies, typeToCreate, name);

            selector.AddMethodAndParameters(methodInfo, methodParameters);
        }
Exemple #2
0
        /// <summary>
        /// Add policies to the <paramref name="policies"/> to configure the
        /// container to call this constructor with the appropriate parameter values.
        /// </summary>
        /// <param name="serviceType">Type of interface registered, ignored in this implementation.</param>
        /// <param name="implementationType">Type to register.</param>
        /// <param name="name">Name used to resolve the type object.</param>
        /// <param name="policies">Policy list to add policies to.</param>
        public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
        {
            MethodInfo methodInfo = this.FindMethod(implementationType);

            this.ValidateMethodCanBeInjected(methodInfo, implementationType);

            SpecifiedMethodsSelectorPolicy selector =
                GetSelectorPolicy(policies, implementationType, name);

            selector.AddMethodAndParameters(methodInfo, this.methodParameters);
        }
        /// <summary>
        /// Add policies to the <paramref name="policies"/> to configure the
        /// container to call this constructor with the appropriate parameter values.
        /// </summary>
        /// <param name="typeToCreate">Type to register.</param>
        /// <param name="name">Name used to resolve the type object.</param>
        /// <param name="policies">Policy list to add policies to.</param>
        public override void AddPolicies(Type typeToCreate, string name, IPolicyList policies)
        {
            MethodInfo methodInfo = typeToCreate.GetMethod(methodName,
                                                           Sequence.ToArray(
                                                               Sequence.Map <InjectionParameterValue, Type>(methodParameters,
                                                                                                            delegate(InjectionParameterValue value)
            {
                return(value.ParameterType);
            })));

            ValidateMethodCanBeInjected(methodInfo, typeToCreate);

            SpecifiedMethodsSelectorPolicy selector =
                GetSelectorPolicy(policies, typeToCreate, name);

            selector.AddMethodAndParameters(methodInfo, methodParameters);
        }