/// <summary>
        /// Add the page configuration as a singleton to the services.
        /// </summary>
        /// <param name="services">The service collection to add to.</param>
        /// <param name="clientConfig">The page config to set.</param>
        /// <returns></returns>
        public static IServiceCollection AddClientConfig(this IServiceCollection services, IClientConfig clientConfig, Action <ClientConfigTagHelperOptions> setupOptions)
        {
            var options = new ClientConfigTagHelperOptions();

            setupOptions(options);
            services.TryAddSingleton <ClientConfigTagHelperOptions>(options);
            services.TryAddSingleton <IClientConfig>(clientConfig);

            return(services);
        }
예제 #2
0
 public ClientConfigTagHelper(IUrlHelperFactory urlHelperFactory, IClientConfig config, ClientConfigTagHelperOptions options)
 {
     this.config           = config;
     this.urlHelperFactory = urlHelperFactory;
     this.options          = options;
 }