The standard provider for types, which activates instances via a IPipeline.
Inheritance: IProvider
示例#1
0
        /// <summary>
        /// Assigns the provider callback to the building configuration.
        /// </summary>
        /// <param name="bindingConfiguration">
        /// The building configuration.
        /// </param>
        /// <param name="prototype">
        /// The prototype.
        /// </param>
        public static void AssignProviderCallback(IBindingConfiguration bindingConfiguration, Type prototype)
        {
            var provider = new StandardProvider(prototype, null);

            bindingConfiguration.ProviderCallback           = ctx => provider;
            bindingConfiguration.InitializeProviderCallback =
                selector => provider.ConstructorScorer      = selector.ConstructorScorer;
        }
示例#2
0
 /// <summary>
 /// Assigns the provider callback to the building configuration.
 /// </summary>
 /// <param name="bindingConfiguration">
 /// The building configuration.
 /// </param>
 /// <param name="prototype">
 /// The prototype.
 /// </param>
 public static void AssignProviderCallback(IBindingConfiguration bindingConfiguration, Type prototype)
 {
     var provider = new StandardProvider(prototype, null);
     bindingConfiguration.ProviderCallback = ctx => provider;
     bindingConfiguration.InitializeProviderCallback =
         selector => provider.ConstructorScorer = selector.ConstructorScorer;
 }
示例#3
0
 /// <summary>
 /// Gets a callback that creates an instance of the <see cref="StandardProvider"/>
 /// for the specified type and constructor.
 /// </summary>
 /// <param name="prototype">The prototype the provider instance will create.</param>
 /// <param name="constructor">The constructor.</param>
 /// <returns>The created callback.</returns>
 public static Func<IContext, IProvider> GetCreationCallback(Type prototype, ConstructorInfo constructor)
 {
     var provider = new StandardProvider(prototype, new SpecificConstructorSelector(constructor));
     return ctx => provider;
 }
示例#4
0
 /// <summary>
 /// Gets a callback that creates an instance of the <see cref="StandardProvider"/>
 /// for the specified type.
 /// </summary>
 /// <param name="prototype">The prototype the provider instance will create.</param>
 /// <param name="selector">The selector.</param>
 /// <returns>The created callback.</returns>
 public static Func<IContext, IProvider> GetCreationCallback(Type prototype, ISelector selector)
 {
     var provider = new StandardProvider(prototype, selector.ConstructorScorer);
     return ctx => provider;
 }
示例#5
0
        /// <summary>
        /// Gets a callback that creates an instance of the <see cref="StandardProvider"/>
        /// for the specified type and constructor.
        /// </summary>
        /// <param name="prototype">The prototype the provider instance will create.</param>
        /// <param name="constructor">The constructor.</param>
        /// <returns>The created callback.</returns>
        public static Func <IContext, IProvider> GetCreationCallback(Type prototype, ConstructorInfo constructor)
        {
            var provider = new StandardProvider(prototype, new SpecificConstructorSelector(constructor));

            return(ctx => provider);
        }
示例#6
0
        /// <summary>
        /// Gets a callback that creates an instance of the <see cref="StandardProvider"/>
        /// for the specified type.
        /// </summary>
        /// <param name="prototype">The prototype the provider instance will create.</param>
        /// <param name="selector">The selector.</param>
        /// <returns>The created callback.</returns>
        public static Func <IContext, IProvider> GetCreationCallback(Type prototype, ISelector selector)
        {
            var provider = new StandardProvider(prototype, selector.ConstructorScorer);

            return(ctx => provider);
        }