public StashboxServiceProvider(IServiceProvider next, IStashboxWebFormsConfiguration configuration) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _next = configuration.CallNextActivator ? null : next; HostingEnvironment.RegisterObject(this); }
private static StashboxServiceProvider SetServiceProvider(IStashboxWebFormsConfiguration configuration) { var serviceProvider = new StashboxServiceProvider(HttpRuntime.WebObjectActivator, configuration); HttpRuntime.WebObjectActivator = serviceProvider; return(serviceProvider); }
internal static void Validate(this IStashboxWebFormsConfiguration config) { if (config.UnresolvableTypeTrackingLimit < 0) { throw new ArgumentOutOfRangeException( nameof(StashboxWebFormsConfiguration.UnresolvableTypeTrackingLimit)); } }
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); } }