Table of Contents

Class SqlCacheExtension

Namespace
Arc4u.Configuration.Sql
Assembly
Arc4u.Caching.dll

Extension methods to register the options of a SQL Server cache.

public static class SqlCacheExtension
Inheritance
SqlCacheExtension
Inherited Members

Methods

AddSqlCache(IServiceCollection, string, IConfiguration, string)

Registers the options of the SQL Server cache with the given name from a configuration section. Nothing is registered when the section does not exist.

public static IServiceCollection AddSqlCache(this IServiceCollection services, string name, IConfiguration configuration, string sectionName)

Parameters

services IServiceCollection

The service collection.

name string

The name of the cache, as used in Name.

configuration IConfiguration

The application configuration.

sectionName string

The path of the section that holds the SqlCacheOption values.

Returns

IServiceCollection

The same IServiceCollection, for chaining.

Exceptions

ArgumentException

name is null or empty and the section exists.

AddSqlCache(IServiceCollection, string, Action<SqlCacheOption>)

Registers the options of the SQL Server cache with the given name.

public static IServiceCollection AddSqlCache(this IServiceCollection services, string name, Action<SqlCacheOption> options)

Parameters

services IServiceCollection

The service collection.

name string

The name of the cache, as used in Name.

options Action<SqlCacheOption>

The action that configures the options.

Returns

IServiceCollection

The same IServiceCollection, for chaining.

Examples

builder.Services.AddSqlCache("Shared", o => o.ConnectionString = "Server=.;Database=Cache;Integrated Security=true");

Exceptions

ArgumentException

name is null or empty.