示例#1
0
        public StashboxServiceProvider(IServiceProvider next, IStashboxWebFormsConfiguration configuration)
        {
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _next          = configuration.CallNextActivator ? null : next;

            HostingEnvironment.RegisterObject(this);
        }
示例#2
0
        private static StashboxServiceProvider SetServiceProvider(IStashboxWebFormsConfiguration configuration)
        {
            var serviceProvider = new StashboxServiceProvider(HttpRuntime.WebObjectActivator, configuration);

            HttpRuntime.WebObjectActivator = serviceProvider;

            return(serviceProvider);
        }
示例#3
0
 internal static void Validate(this IStashboxWebFormsConfiguration config)
 {
     if (config.UnresolvableTypeTrackingLimit < 0)
     {
         throw new ArgumentOutOfRangeException(
                   nameof(StashboxWebFormsConfiguration.UnresolvableTypeTrackingLimit));
     }
 }
示例#4
0
        public static HttpApplication AddStashbox(
            this HttpApplication application,
            [NotNull] IStashboxWebFormsConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            lock (Lock)
            {
                AttachEvents(application);

                configuration.Validate();

                RootContainer = SetServiceProvider(configuration).RootContainer;

                return(application);
            }
        }