/// <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); }
public ClientConfigTagHelper(IUrlHelperFactory urlHelperFactory, IClientConfig config, ClientConfigTagHelperOptions options) { this.config = config; this.urlHelperFactory = urlHelperFactory; this.options = options; }