Exemplo n.º 1
0
        /// <summary>
        /// Configures services to provide CSLA AspNetCore support
        /// </summary>
        /// <param name="config">ICslaConfiguration instance</param>
        /// <param name="options">Options object</param>
        /// <returns></returns>
        public static ICslaConfiguration AddAspNetCore(this ICslaConfiguration config, Action <AspNetCoreConfigurationOptions> options)
        {
            var localOptions = new AspNetCoreConfigurationOptions();

            options?.Invoke(localOptions);
            config.Services.TryAddTransient((p) => new Channels.Local.LocalProxyOptions {
                CreateScopePerCall = false
            });
            return(config);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Configures services to provide CSLA AspNetCore support
        /// </summary>
        /// <param name="config">CslaOptions instance</param>
        /// <param name="options">Options object</param>
        /// <returns></returns>
        public static CslaOptions AddAspNetCore(this CslaOptions config, Action <AspNetCoreConfigurationOptions> options)
        {
            var localOptions = new AspNetCoreConfigurationOptions();

            options?.Invoke(localOptions);
#if NET5_0_OR_GREATER
            config.Services.AddScoped <ActiveCircuitState>();
            config.Services.AddScoped(typeof(CircuitHandler), typeof(ActiveCircuitHandler));
#endif
            config.Services.AddScoped(typeof(IContextManager), typeof(ApplicationContextManagerHttpContext));
            return(config);
        }