public AutofacSagaRepositoryFactory(ILifetimeScopeProvider scopeProvider, string name = default, Action <ContainerBuilder, ConsumeContext> configureScope = default) { _scopeProvider = scopeProvider; _name = name ?? "message"; _configureScope = configureScope; }
public AutofacExecuteActivityScopeProvider(ILifetimeScopeProvider scopeProvider, string name, Action <ContainerBuilder, ExecuteContext <TArguments> > configureScope = null) { _scopeProvider = scopeProvider; _name = name; _configureScope = configureScope; }
protected void Application_Start() { ModelValidatorProviders.Providers.Clear(); ModelValidatorProviders.Providers.Add(new EasyModelValidatorProvider()); ModelMetadataProviders.Current = new EasyModelMetaDataProvider(); //ModelBinderProviders.BinderProviders.Add(new EasyBinderProvider()); AutofacContainerBuilder = new ContainerBuilder(); AutofacContainerBuilder.RegisterType <FilterControllerFactory>().As <IControllerFactory>(); AutofacContainerBuilder.RegisterType <EasyControllerActivator>().As <IControllerActivator>(); AutofacContainerBuilder.RegisterType <HttpItemsValueProvider>().As <IHttpItemsValueProvider>().SingleInstance(); //AutofacContainerBuilder.RegisterType<ApplicationContext>().As<IApplicationContext>().InstancePerLifetimeScope(); AutofacContainerBuilder.RegisterType <RequestLifetimeScopeProvider>().As <ILifetimeScopeProvider>().SingleInstance(); //AutofacContainerBuilder.RegisterType<DataDictionaryService>().As<IDataDictionaryService>(); //AutofacContainerBuilder.RegisterType<LanguageService>().As<ILanguageService>().SingleInstance(); System.Web.Mvc.DependencyResolver.SetResolver(new EasyDependencyResolver()); Application_Starting(); _lifetimeScopeProvider = new AutofacRegister(AutofacContainerBuilder, typeof(System.Web.Mvc.Controller)).Regist(AutofacContainerBuilder.Build()); TaskManager.ExcuteAll(); Application_Started(); }
public static void AddScopedFilter <TContext, T>(this IPipeConfigurator <TContext> configurator, Type scopedType, ILifetimeScopeProvider provider) where TContext : class, PipeContext where T : class { if (typeof(T).HasInterface <Fault>()) { return; } if (!scopedType.IsGenericType || !scopedType.IsGenericTypeDefinition) { throw new ArgumentException("The scoped filter must be a generic type definition", nameof(scopedType)); } var filterType = scopedType.MakeGenericType(typeof(T)); if (!filterType.HasInterface(typeof(IFilter <TContext>))) { throw new ArgumentException($"The scoped filter must implement {TypeMetadataCache<IFilter<TContext>>.ShortName} ", nameof(scopedType)); } var scopeProviderType = typeof(AutofacFilterContextScopeProvider <,>).MakeGenericType(filterType, typeof(TContext)); var scopeProvider = (IFilterContextScopeProvider <TContext>)Activator.CreateInstance(scopeProviderType, provider); var filter = new ScopedFilter <TContext>(scopeProvider); var specification = new FilterPipeSpecification <TContext>(filter); configurator.AddPipeSpecification(specification); }
public ScopedConsumePipeSpecificationObserver(IConsumePipeConfigurator configurator, Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) : base(configurator) { _filterType = filterType; _lifetimeScopeProvider = lifetimeScopeProvider; Connect(this); }
public AutofacSagaScopeProvider(ILifetimeScopeProvider scopeProvider, string name, Action <ContainerBuilder, ConsumeContext> configureScope) { _scopeProvider = scopeProvider; _name = name; _configureScope = configureScope; _scopeActions = new List <Action <ConsumeContext> >(); }
public AutofacCompensateActivityScopeProvider(ILifetimeScopeProvider scopeProvider, string name, Action <ContainerBuilder, CompensateContext <TLog> > configureScope = null) { _scopeProvider = scopeProvider; _name = name; _configureScope = configureScope; }
public static void SetLifetimeScopeProvider(ILifetimeScopeProvider lifetimeScopeProvider) { if (lifetimeScopeProvider == null) { throw new ArgumentNullException("lifetimeScopeProvider"); } LifetimeScopeProvider = lifetimeScopeProvider; }
private void RegisterWorkerDependancyResolvers() { _requestLifetimeScopeProvider = new RequestLifetimeScopeProvider(_applicationContainer); var mvcResolver = new Autofac.Integration.Mvc.AutofacDependencyResolver(_applicationContainer, _requestLifetimeScopeProvider); _originalResolver = DependencyResolver.Current; DependencyResolver.SetResolver(mvcResolver); }
/// <summary> /// Initializes a new instance of the <see cref="AutofacDependencyResolver"/> class. /// </summary> /// <param name="container">The container that nested lifetime scopes will be create from.</param> /// <param name="lifetimeScopeProvider">A <see cref="ILifetimeScopeProvider"/> implementation for /// creating new lifetime scopes.</param> public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider) : this(container) { if (lifetimeScopeProvider == null) { throw new ArgumentNullException("lifetimeScopeProvider"); } _lifetimeScopeProvider = lifetimeScopeProvider; }
/// <summary> /// Initializes a new instance of the <see cref="AutofacDependencyResolver"/> class. /// </summary> /// <param name="container">The container that nested lifetime scopes will be create from.</param> /// <param name="lifetimeScopeProvider">A <see cref="ILifetimeScopeProvider"/> implementation for /// creating new lifetime scopes.</param> /// <param name="configurationAction">Action on a <see cref="ContainerBuilder"/> /// that adds component registations visible only in nested lifetime scopes.</param> public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider, Action <ContainerBuilder> configurationAction) : this(container, lifetimeScopeProvider) { if (configurationAction == null) { throw new ArgumentNullException("configurationAction"); } _configurationAction = configurationAction; }
public MessageLifetimeScopeConfigurationObserver(IConsumePipeConfigurator receiveEndpointConfigurator, ILifetimeScopeProvider scopeProvider, string name, Action <ContainerBuilder, ConsumeContext> configureScope) : base(receiveEndpointConfigurator) { _scopeProvider = scopeProvider; _name = name; _configureScope = configureScope; Connect(this); }
/// <summary> /// Use scoped filter for <see cref="ConsumeContext{T}" /> /// </summary> /// <param name="configurator"></param> /// <param name="filterType">Filter type</param> /// <param name="lifetimeScopeProvider">Lifetime Scope Provider</param> public static void UseConsumeFilter(this IConsumePipeConfigurator configurator, Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (lifetimeScopeProvider == null) { throw new ArgumentNullException(nameof(lifetimeScopeProvider)); } var observer = new ScopedConsumePipeSpecificationObserver(configurator, filterType, lifetimeScopeProvider); }
/// <summary> /// Use scoped filter for <see cref="ExecuteContext{TArguments}" /> /// </summary> /// <param name="configurator"></param> /// <param name="filterType">Filter type</param> /// <param name="lifetimeScopeProvider">Lifetime Scope Provider</param> public static void UseExecuteActivityFilter(this IConsumePipeConfigurator configurator, Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (lifetimeScopeProvider == null) { throw new ArgumentNullException(nameof(lifetimeScopeProvider)); } var observer = new ScopedExecuteActivityPipeSpecificationObserver(filterType, lifetimeScopeProvider); configurator.ConnectActivityConfigurationObserver(observer); }
protected void Application_Start() { ModelValidatorProviders.Providers.Clear(); ModelValidatorProviders.Providers.Add(new EasyModelValidatorProvider()); ModelMetadataProviders.Current = new EasyModelMetaDataProvider(); //ModelBinderProviders.BinderProviders.Add(new EasyBinderProvider()); AutofacContainerBuilder = new ContainerBuilder(); AutofacContainerBuilder.RegisterType <FilterControllerFactory>().As <IControllerFactory>(); AutofacContainerBuilder.RegisterType <EasyControllerActivator>().As <IControllerActivator>(); AutofacContainerBuilder.RegisterType <HttpItemsValueProvider>().As <IHttpItemsValueProvider>().SingleInstance(); AutofacContainerBuilder.RegisterType <ApplicationContext>().As <IApplicationContext>().InstancePerLifetimeScope(); AutofacContainerBuilder.RegisterType <RequestLifetimeScopeProvider>().As <ILifetimeScopeProvider>().SingleInstance(); //AutofacContainerBuilder.RegisterType<DataDictionaryService>().As<IDataDictionaryService>(); //AutofacContainerBuilder.RegisterType<LanguageService>().As<ILanguageService>().SingleInstance(); var controllerType = typeof(System.Web.Mvc.Controller); var moduleType = typeof(IModule); PublicTypes.Each(t => { if (t != null && !t.IsInterface && !t.IsAbstract && t.IsPublic && !t.IsGenericType) { if (controllerType.IsAssignableFrom(t)) {//register controller AutofacContainerBuilder.RegisterType(t); } if (moduleType.IsAssignableFrom(t)) { ((IModule)Activator.CreateInstance(t)).Load(new AutofacContainerAdapter(AutofacContainerBuilder)); } } }); System.Web.Mvc.DependencyResolver.SetResolver(new EasyDependencyResolver()); Application_Starting(); _lifetimeScopeProvider = new AutofacRegister(AutofacContainerBuilder).Regist(AutofacContainerBuilder.Build()); TaskManager.ExcuteAll(); Application_Started(); }
/// <summary> /// Initializes a new instance of the <see cref="SharePointContainerProvider"/> class. /// </summary> /// <param name="appRootNamespace"> /// The app root namespace. /// </param> /// <param name="assemblyFileNameMatcher"> /// The assembly file name matcher (will be used instead of the appRootNamespace to /// match assembly names in the GAC). The appRootNamespace still acts as the provided /// container's unique key among all the other containers that live in the AppDomain. /// </param> public SharePointContainerProvider(string appRootNamespace, Func<string, bool> assemblyFileNameMatcher) : base(appRootNamespace, assemblyFileNameMatcher) { this.siteLifetimeScopeProvider = new SPSiteLifetimeScopeProvider(this); this.webLifetimeScopeProvider = new SPWebLifetimeScopeProvider(this); this.requestLifetimeScopeProvider = new SPRequestLifetimeScopeProvider(this); }
public AutofacJobFactory(ILifetimeScopeProvider containerProvider) { _containerProvider = containerProvider; }
/// <summary> /// Initializes a new instance of the <see cref="AutofacDependencyResolver"/> class. /// </summary> /// <param name="container">The container that nested lifetime scopes will be create from.</param> /// <param name="lifetimeScopeProvider">A <see cref="ILifetimeScopeProvider"/> implementation for /// creating new lifetime scopes.</param> /// <param name="configurationAction">Action on a <see cref="ContainerBuilder"/> /// that adds component registations visible only in nested lifetime scopes.</param> public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider, Action<ContainerBuilder> configurationAction) : this(container, lifetimeScopeProvider) { if (configurationAction == null) throw new ArgumentNullException("configurationAction"); _configurationAction = configurationAction; }
public IocResolver(ILifetimeScopeProvider provider) { _provider = provider; }
public ScopedCompensateActivityPipeSpecificationObserver(Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) { _filterType = filterType; _lifetimeScopeProvider = lifetimeScopeProvider; }
internal static void SetLifetimeScopeProvider(ILifetimeScopeProvider scopeProvider) { Invariant.IsNotNull(scopeProvider, "scopeProvider"); lifetimeScopeProvider = scopeProvider; }
/// <summary> /// Initializes a new instance of the <see cref="SharePointContainerProvider"/> class. /// </summary> /// <param name="appRootNamespace"> /// The app root namespace. /// </param> /// <param name="assemblyFileNameMatcher"> /// The assembly file name matcher (will be used instead of the AppRootNamespace to /// match assembly names in the GAC). The AppRootNamespace still acts as the provided /// container's unique key among all the other containers that live in the AppDomain. /// </param> public SharePointContainerProvider(string appRootNamespace, Func <string, bool> assemblyFileNameMatcher) : base(appRootNamespace, assemblyFileNameMatcher) { this.siteLifetimeScopeProvider = new SPSiteLifetimeScopeProvider(this); this.webLifetimeScopeProvider = new SPWebLifetimeScopeProvider(this); this.requestLifetimeScopeProvider = new SPRequestLifetimeScopeProvider(this); }
public static void SetLifetimeScopeProvider(ILifetimeScopeProvider lifetimeScopeProvider) { LifetimeScopeProvider = lifetimeScopeProvider ?? throw new ArgumentNullException("lifetimeScopeProvider"); }
protected void Application_Start() { ModelValidatorProviders.Providers.Clear(); ModelValidatorProviders.Providers.Add(new EasyModelValidatorProvider()); ModelMetadataProviders.Current = new EasyModelMetaDataProvider(); //ModelBinderProviders.BinderProviders.Add(new EasyBinderProvider()); AutofacContainerBuilder = new ContainerBuilder(); AutofacContainerBuilder.RegisterType<FilterControllerFactory>().As<IControllerFactory>(); AutofacContainerBuilder.RegisterType<EasyControllerActivator>().As<IControllerActivator>(); AutofacContainerBuilder.RegisterType<HttpItemsValueProvider>().As<IHttpItemsValueProvider>().SingleInstance(); AutofacContainerBuilder.RegisterType<ApplicationContext>().As<IApplicationContext>().InstancePerLifetimeScope(); AutofacContainerBuilder.RegisterType<RequestLifetimeScopeProvider>().As<ILifetimeScopeProvider>().SingleInstance(); //AutofacContainerBuilder.RegisterType<DataDictionaryService>().As<IDataDictionaryService>(); //AutofacContainerBuilder.RegisterType<LanguageService>().As<ILanguageService>().SingleInstance(); var controllerType = typeof(System.Web.Mvc.Controller); var moduleType = typeof(IModule); PublicTypes.Each(t => { if (t != null && !t.IsInterface && !t.IsAbstract && t.IsPublic && !t.IsGenericType) { if (controllerType.IsAssignableFrom(t)) {//register controller AutofacContainerBuilder.RegisterType(t); } if (moduleType.IsAssignableFrom(t)) { ((IModule)Activator.CreateInstance(t)).Load(new AutofacContainerAdapter(AutofacContainerBuilder)); } } }); System.Web.Mvc.DependencyResolver.SetResolver(new EasyDependencyResolver()); Application_Starting(); _lifetimeScopeProvider = new AutofacRegister(AutofacContainerBuilder).Regist(AutofacContainerBuilder.Build()); TaskManager.ExcuteAll(); Application_Started(); }
public PlexDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider) : base(container, lifetimeScopeProvider) { }
public PlexDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider, Action <ContainerBuilder> configurationAction) : base(container, lifetimeScopeProvider, configurationAction) { }
/// <summary> /// Use scoped filter for <see cref="SendContext{T}" /> /// </summary> /// <param name="configurator"></param> /// <param name="filterType">Filter type</param> /// <param name="lifetimeScopeProvider">Lifetime Scope Provider</param> public static void UseSendFilter(this ISendPipelineConfigurator configurator, Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (lifetimeScopeProvider == null) { throw new ArgumentNullException(nameof(lifetimeScopeProvider)); } var observer = new ScopedSendPipeSpecificationObserver(filterType, lifetimeScopeProvider); configurator.ConfigureSend(cfg => cfg.ConnectSendPipeSpecificationObserver(observer)); }
public AutofacSagaScopeProvider(ILifetimeScopeProvider scopeProvider, string name) { _scopeProvider = scopeProvider; _name = name; _scopeActions = new List <Action <ConsumeContext> >(); }
public AutofacFilterContextScopeProvider(ILifetimeScopeProvider lifetimeScopeProvider) { _lifetimeScopeProvider = lifetimeScopeProvider; }
public AutofacExecuteActivityScopeProvider(ILifetimeScopeProvider scopeProvider, string name) { _scopeProvider = scopeProvider; _name = name; }
/// <summary> /// Initializes a new instance of the <see cref="AutofacDependencyResolver"/> class. /// </summary> /// <param name="container">The container that nested lifetime scopes will be create from.</param> /// <param name="lifetimeScopeProvider">A <see cref="ILifetimeScopeProvider"/> implementation for /// creating new lifetime scopes.</param> public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider) : this(container) { this._lifetimeScopeProvider = lifetimeScopeProvider ?? throw new ArgumentNullException(nameof(lifetimeScopeProvider)); }
public AutofacSagaRepositoryContextFactory(ILifetimeScopeProvider scopeProvider, string name, Action <ContainerBuilder, ConsumeContext> configureScope) { _scopeProvider = scopeProvider; _configureScope = configureScope; _name = name ?? DefaultScopeName; }
public AutofacConsumerScopeProvider(ILifetimeScopeProvider scopeProvider, string name, Action <ContainerBuilder, ConsumeContext> configureScope) { _scopeProvider = scopeProvider; _name = name; _configureScope = configureScope; }
public ScopedSendPipeSpecificationObserver(Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) { _filterType = filterType; _lifetimeScopeProvider = lifetimeScopeProvider; }
/// <summary> /// Initializes a new instance of the <see cref="AutofacDependencyResolver"/> class. /// </summary> /// <param name="container">The container that nested lifetime scopes will be create from.</param> /// <param name="lifetimeScopeProvider">A <see cref="ILifetimeScopeProvider"/> implementation for /// creating new lifetime scopes.</param> public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider) : this(container) { if (lifetimeScopeProvider == null) throw new ArgumentNullException("lifetimeScopeProvider"); _lifetimeScopeProvider = lifetimeScopeProvider; }