コード例 #1
0
ファイル: PartBuilderOfT.cs プロジェクト: zqb971/mef
        public PartBuilder<T> SelectConstructor(Expression<Func<ParameterImportBuilder, T>> constructorFilter)
        {
            Requires.NotNull(constructorFilter, "constructorFilter");

            var adapter = new ConstructorExpressionAdapter(constructorFilter);
            base.SelectConstructor(adapter.SelectConstructor, adapter.ConfigureConstructorImports);
            return this;
        }
コード例 #2
0
        /// <summary>
        /// Select which of the available constructors will be used to instantiate the part.
        /// </summary>
        /// <param name="constructorSelector">Expression that selects a single constructor.</param>
        /// <returns>A part builder allowing further configuration of the part.</returns>
        public PartConventionBuilder <T> SelectConstructor(Expression <Func <ParameterImportConventionBuilder, T> > constructorSelector)
        {
            Requires.NotNull(constructorSelector, nameof(constructorSelector));

            var adapter = new ConstructorExpressionAdapter(constructorSelector);

            base.SelectConstructor(adapter.SelectConstructor, adapter.ConfigureConstructorImports);
            return(this);
        }
コード例 #3
0
        /// <summary>
        /// Select which of the available constructors will be used to instantiate the part.
        /// </summary>
        /// <param name="constructorSelector">Expression that selects a single constructor.</param>
        /// <returns>A part builder allowing further configuration of the part.</returns>
        public PartConventionBuilder <T> SelectConstructor(Expression <Func <ParameterImportConventionBuilder, T> > constructorSelector)
        {
            if (constructorSelector == null)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            var adapter = new ConstructorExpressionAdapter(constructorSelector);

            base.SelectConstructor(adapter.SelectConstructor, adapter.ConfigureConstructorImports);
            return(this);
        }