Exemplo n.º 1
0
        public IDependencyRegistrar <T> WithResolvedParam <TParam>(Func <IResolutionContext, TParam> callback)
        {
            CheckValidForParameter();

            ((IRegistrationBuilder <T, ConcreteReflectionActivatorData, SingleRegistrationStyle>)_registration)
            .WithParameter(AutofacContainerBuilder.GenerateResolvedParameter(callback));
            return(this);
        }
 internal AutofacInstanceRegistrar(AutofacContainerBuilder masterBuilder, ContainerBuilder autofacBuilder)
 {
     _autofacBuilder = autofacBuilder;
     _masterBuilder  = masterBuilder;
 }
 /// <summary>Marks the registration as having a specific constructor parameter discovered by name, whose value is resolved by a callback. </summary>
 /// <typeparam name="T">The type of the service to resolve in order to pass in as the value of the parameter.</typeparam>
 /// <returns>.</returns>
 public IServiceRegistrarModifier <TContract, TImplementation> WithNamedResolvedParam <T>(string name, Func <IResolutionContext, T> callback)
 {
     _containerRegistrationBuilder.WithParameter(AutofacContainerBuilder.GenerateResolvedParameter(name, callback));
     return(this);
 }
 /// <summary>Marks the registration as having a specific constructor parameter discovered by type, whose value is resolved by the container (when given the name of the service). </summary>
 /// <typeparam name="T">The type of the service to resolve in order to pass in as the value of the parameter.</typeparam>
 /// <returns>.</returns>
 public IServiceRegistrarModifier <TContract, TImplementation> WithResolvedParam <T>(string serviceName)
 {
     _containerRegistrationBuilder.WithParameter(AutofacContainerBuilder.GenerateResolvedParameter <T>(serviceName));
     return(this);
 }
Exemplo n.º 5
0
 internal AutofacRuntimeSimpleTypeRegistrar(AutofacContainerBuilder masterBuilder, ContainerBuilder autofacBuilder, Type implementationType)
     : base(masterBuilder, autofacBuilder, implementationType)
 {
 }
 /// <summary>Marks the registration as having a specific constructor parameter discovered by type, whose value is resolved by a callback. </summary>
 /// <typeparam name="T">The type of the service to resolve in order to pass in as the value of the parameter.</typeparam>
 /// <returns>.</returns>
 public IRuntimeTypeRegistrarModifier <TContract> WithResolvedParam <T>(Func <IResolutionContext, T> callback)
 {
     _containerRegistrationBuilder.WithParameter(AutofacContainerBuilder.GenerateResolvedParameter(callback));
     return(this);
 }
 public IRuntimeTypeRegistrarModifier <TContract> WithNamedResolvedParam(Type paramType, string name, Func <IResolutionContext, object> callback)
 {
     _containerRegistrationBuilder.WithParameter(AutofacContainerBuilder.GenerateResolvedParameter(paramType, name, callback));
     return(this);
 }
 public IRuntimeTypeRegistrarModifier <TContract> WithResolvedParam(Type paramType, string serviceName)
 {
     _containerRegistrationBuilder.WithParameter(AutofacContainerBuilder.GenerateResolvedParameter(paramType, serviceName));
     return(this);
 }
 internal AutofacRuntimeTypeRegistrar(AutofacContainerBuilder masterBuilder, ContainerBuilder autofacBuilder, Type implementationType)
 {
     _implementationType = implementationType;
     _autofacBuilder     = autofacBuilder;
     _masterBuilder      = masterBuilder;
 }