Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql provider #1

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions EasyCaching.sln
Original file line number Diff line number Diff line change
@@ -1,51 +1,54 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A0F5CC7E-155F-4726-8DEB-E966950B3FE9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{F88D727A-9F9C-43D9-90B1-D4A02BF8BC98}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EBB55F65-7D07-4281-8D5E-7B0CA88E1AD0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Core", "src\EasyCaching.Core\EasyCaching.Core.csproj", "{CE61FAA2-0233-451C-991D-4222ED61C84B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Core", "src\EasyCaching.Core\EasyCaching.Core.csproj", "{CE61FAA2-0233-451C-991D-4222ED61C84B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.InMemory", "src\EasyCaching.InMemory\EasyCaching.InMemory.csproj", "{B9490432-737B-4518-B851-9D40FD29B392}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.InMemory", "src\EasyCaching.InMemory\EasyCaching.InMemory.csproj", "{B9490432-737B-4518-B851-9D40FD29B392}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Serialization.MessagePack", "src\EasyCaching.Serialization.MessagePack\EasyCaching.Serialization.MessagePack.csproj", "{50D8C42C-1BC0-4133-8B70-63A6649DBD74}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Serialization.MessagePack", "src\EasyCaching.Serialization.MessagePack\EasyCaching.Serialization.MessagePack.csproj", "{50D8C42C-1BC0-4133-8B70-63A6649DBD74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Interceptor.AspectCore", "src\EasyCaching.Interceptor.AspectCore\EasyCaching.Interceptor.AspectCore.csproj", "{BED4832E-A790-42A6-978D-E0C1A215E638}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Interceptor.AspectCore", "src\EasyCaching.Interceptor.AspectCore\EasyCaching.Interceptor.AspectCore.csproj", "{BED4832E-A790-42A6-978D-E0C1A215E638}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Bus.Redis", "src\EasyCaching.Bus.Redis\EasyCaching.Bus.Redis.csproj", "{07326A03-B144-469F-837B-31DD3E0EB1AC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Bus.Redis", "src\EasyCaching.Bus.Redis\EasyCaching.Bus.Redis.csproj", "{07326A03-B144-469F-837B-31DD3E0EB1AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Bus.RabbitMQ", "src\EasyCaching.Bus.RabbitMQ\EasyCaching.Bus.RabbitMQ.csproj", "{265FB0C5-2C34-438D-B671-63836954EB5A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Bus.RabbitMQ", "src\EasyCaching.Bus.RabbitMQ\EasyCaching.Bus.RabbitMQ.csproj", "{265FB0C5-2C34-438D-B671-63836954EB5A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Interceptor.Castle", "src\EasyCaching.Interceptor.Castle\EasyCaching.Interceptor.Castle.csproj", "{7B55B6D9-4221-4E82-AED6-BEC9A60C99D2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Interceptor.Castle", "src\EasyCaching.Interceptor.Castle\EasyCaching.Interceptor.Castle.csproj", "{7B55B6D9-4221-4E82-AED6-BEC9A60C99D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Serialization.Json", "src\EasyCaching.Serialization.Json\EasyCaching.Serialization.Json.csproj", "{F0302BE8-188A-4EAF-8391-514CA9352DB3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Serialization.Json", "src\EasyCaching.Serialization.Json\EasyCaching.Serialization.Json.csproj", "{F0302BE8-188A-4EAF-8391-514CA9352DB3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Serialization.Protobuf", "src\EasyCaching.Serialization.Protobuf\EasyCaching.Serialization.Protobuf.csproj", "{3AAEDDBA-5037-4061-84E5-667F89C11F8E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Serialization.Protobuf", "src\EasyCaching.Serialization.Protobuf\EasyCaching.Serialization.Protobuf.csproj", "{3AAEDDBA-5037-4061-84E5-667F89C11F8E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.ResponseCaching", "src\EasyCaching.ResponseCaching\EasyCaching.ResponseCaching.csproj", "{261EE728-4965-4C0E-B99B-3B188442263A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.ResponseCaching", "src\EasyCaching.ResponseCaching\EasyCaching.ResponseCaching.csproj", "{261EE728-4965-4C0E-B99B-3B188442263A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Demo.Providers", "sample\EasyCaching.Demo.Providers\EasyCaching.Demo.Providers.csproj", "{4193DF5A-E034-4917-83F4-380E8D7DCF83}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Demo.Providers", "sample\EasyCaching.Demo.Providers\EasyCaching.Demo.Providers.csproj", "{4193DF5A-E034-4917-83F4-380E8D7DCF83}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Demo.Interceptors", "sample\EasyCaching.Demo.Interceptors\EasyCaching.Demo.Interceptors.csproj", "{F7DD4826-1375-42B3-97BA-37685460282E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Demo.Interceptors", "sample\EasyCaching.Demo.Interceptors\EasyCaching.Demo.Interceptors.csproj", "{F7DD4826-1375-42B3-97BA-37685460282E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.SQLite", "src\EasyCaching.SQLite\EasyCaching.SQLite.csproj", "{50089D69-50CF-49B7-8939-59C309A22336}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.SQLite", "src\EasyCaching.SQLite\EasyCaching.SQLite.csproj", "{50089D69-50CF-49B7-8939-59C309A22336}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Redis", "src\EasyCaching.Redis\EasyCaching.Redis.csproj", "{F58E5C6F-407F-4E80-9282-2028E9810F55}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Redis", "src\EasyCaching.Redis\EasyCaching.Redis.csproj", "{F58E5C6F-407F-4E80-9282-2028E9810F55}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Memcached", "src\EasyCaching.Memcached\EasyCaching.Memcached.csproj", "{709D2333-42A7-45E6-B175-E630DCC1D807}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Memcached", "src\EasyCaching.Memcached\EasyCaching.Memcached.csproj", "{709D2333-42A7-45E6-B175-E630DCC1D807}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.HybridCache", "src\EasyCaching.HybridCache\EasyCaching.HybridCache.csproj", "{18DB08CD-B8CC-4409-9C7C-2906BCAA8827}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.HybridCache", "src\EasyCaching.HybridCache\EasyCaching.HybridCache.csproj", "{18DB08CD-B8CC-4409-9C7C-2906BCAA8827}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Demo.ResponseCaching", "sample\EasyCaching.Demo.ResponseCaching\EasyCaching.Demo.ResponseCaching.csproj", "{76A5C2E3-6525-45A0-9CE7-649F3235A443}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Demo.ResponseCaching", "sample\EasyCaching.Demo.ResponseCaching\EasyCaching.Demo.ResponseCaching.csproj", "{76A5C2E3-6525-45A0-9CE7-649F3235A443}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.UnitTests", "test\EasyCaching.UnitTests\EasyCaching.UnitTests.csproj", "{2A8D7103-DF64-47B6-A406-8F8559AF7E7F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.UnitTests", "test\EasyCaching.UnitTests\EasyCaching.UnitTests.csproj", "{2A8D7103-DF64-47B6-A406-8F8559AF7E7F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.PerformanceTests", "test\EasyCaching.PerformanceTests\EasyCaching.PerformanceTests.csproj", "{6EBE36A2-F128-4C63-B90A-B700D8C2F2E8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.PerformanceTests", "test\EasyCaching.PerformanceTests\EasyCaching.PerformanceTests.csproj", "{6EBE36A2-F128-4C63-B90A-B700D8C2F2E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.CSRedis", "src\EasyCaching.CSRedis\EasyCaching.CSRedis.csproj", "{6584761E-E51C-408F-BE51-CA0F6269589B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.CSRedis", "src\EasyCaching.CSRedis\EasyCaching.CSRedis.csproj", "{6584761E-E51C-408F-BE51-CA0F6269589B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.SQLServerCache", "src\EasyCaching.SQLServerCache\EasyCaching.SQLServerCache.csproj", "{C9D8DB1F-8257-4C01-B173-388D659FB1E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Bus.CSRedis", "src\EasyCaching.Bus.CSRedis\EasyCaching.Bus.CSRedis.csproj", "{861E5373-BEF6-4AA2-92C7-8F4941A079E7}"
EndProject
Expand Down Expand Up @@ -135,11 +138,18 @@ Global
{6584761E-E51C-408F-BE51-CA0F6269589B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6584761E-E51C-408F-BE51-CA0F6269589B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6584761E-E51C-408F-BE51-CA0F6269589B}.Release|Any CPU.Build.0 = Release|Any CPU
{C9D8DB1F-8257-4C01-B173-388D659FB1E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9D8DB1F-8257-4C01-B173-388D659FB1E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9D8DB1F-8257-4C01-B173-388D659FB1E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9D8DB1F-8257-4C01-B173-388D659FB1E5}.Release|Any CPU.Build.0 = Release|Any CPU
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CE61FAA2-0233-451C-991D-4222ED61C84B} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
{B9490432-737B-4518-B851-9D40FD29B392} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
Expand All @@ -161,6 +171,10 @@ Global
{2A8D7103-DF64-47B6-A406-8F8559AF7E7F} = {EBB55F65-7D07-4281-8D5E-7B0CA88E1AD0}
{6EBE36A2-F128-4C63-B90A-B700D8C2F2E8} = {EBB55F65-7D07-4281-8D5E-7B0CA88E1AD0}
{6584761E-E51C-408F-BE51-CA0F6269589B} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
{C9D8DB1F-8257-4C01-B173-388D659FB1E5} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
{861E5373-BEF6-4AA2-92C7-8F4941A079E7} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {71E7E21A-1DC2-4918-9FA7-3B6879856B2C}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using EasyCaching.Core.Configurations;
using Microsoft.AspNetCore.Builder;

public static class EasyCachingApplicationBuliderExtensions
public static class EasyCachingApplicationBuilderExtensions
{
/// <summary>
/// Uses the easy caching.
Expand All @@ -16,9 +16,9 @@ public static IApplicationBuilder UseEasyCaching(this IApplicationBuilder app)

var options = app.ApplicationServices.GetService(typeof(EasyCachingOptions));

if (options != null && options is EasyCachingOptions)
if (options is EasyCachingOptions cachingOptions)
{
foreach (var serviceExtension in ((EasyCachingOptions)options).Extensions)
foreach (var serviceExtension in cachingOptions.Extensions)
{
serviceExtension.WithServices(app);
}
Expand Down
1 change: 0 additions & 1 deletion src/EasyCaching.Core/EasyCaching.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

<ItemGroup>
<Folder Include="Internal\" />
<Folder Include="Configurations\" />
<Folder Include="Bus\" />
<Folder Include="Serialization\" />
<Folder Include="Interceptor\" />
Expand Down
2 changes: 1 addition & 1 deletion src/EasyCaching.Core/Internal/CachingProviderType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public enum CachingProviderType
Memcached,
Redis,
SQLite,
Ext1,
SQLServer,
Ext2
}
}
9 changes: 9 additions & 0 deletions src/EasyCaching.Core/Internal/EasyCachingConstValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public class EasyCachingConstValue
/// The SQLite section.
/// </summary>
public const string SQLiteSection = "easycaching:sqlite";
/// <summary>
/// The SQLServer section.
/// </summary>
public const string SQLServerSection = "easycaching:sqlserver";

/// <summary>
/// The in-memory section.
Expand Down Expand Up @@ -69,5 +73,10 @@ public class EasyCachingConstValue
/// The default name of the SQLite.
/// </summary>
public const string DefaultSQLiteName = "DefaultSQLite";

/// <summary>
/// The default name of the SQL Server.
/// </summary>
public const string DefaultSQLServerName = "DefaultSQLServer";
}
}
123 changes: 123 additions & 0 deletions src/EasyCaching.SQLServerCache/Configurations/ConstSQL.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
namespace EasyCaching.SQLServer.Configurations
{
/// <summary>
/// Const sql.
/// </summary>
public static class ConstSQL
{
/// <summary>
/// The setsql.
/// </summary>
public const string SETSQL = @"
DELETE FROM [{0}].[{1}] WHERE [cachekey] = @cachekey AND [name]=@name;
INSERT INTO [{0}].[{1}]
([name]
,[cachekey]
,[cachevalue]
,[expiration])
VALUES
(@name
,@cachekey
,@cachevalue
,DATEADD(second, @expiration, getutcdate()));";

/// <summary>
/// The trysetsql.
/// </summary>
public const string TRYSETSQL = @"
INSERT INTO [{0}].[{1}]
([name]
,[cachekey]
,[cachevalue]
,[expiration])
SELECT @name,@cachekey,@cachevalue,DATEADD(second, @expiration, getutcdate())
WHERE NOT EXISTS (SELECT 1 FROM [{0}].[{1}] WHERE [cachekey] = @cachekey AND [name]=@name AND [expiration] > getutcdate());";



/// <summary>
/// The getsql.
/// </summary>
public const string GETSQL = @"SELECT [cachevalue]
FROM [{0}].[{1}]
WHERE [cachekey] = @cachekey AND [name]=@name AND [expiration] > getutcdate()";

/// <summary>
/// The getallsql.
/// </summary>
public const string GETALLSQL = @"SELECT [cachekey],[cachevalue]
FROM [{0}].[{1}]
WHERE [cachekey] IN @cachekey AND [name]=@name AND [expiration] > getutcdate()";

/// <summary>
/// The getbyprefixsql.
/// </summary>
public const string GETBYPREFIXSQL = @"SELECT [cachekey],[cachevalue]
FROM [{0}].[{1}]
WHERE [cachekey] LIKE @cachekey AND [name]=@name AND [expiration] > getutcdate()";

/// <summary>
/// The removesql.
/// </summary>
public const string REMOVESQL = @"DELETE FROM [{0}].[{1}] WHERE [cachekey] = @cachekey AND [name] = @name ";

/// <summary>
/// The removebyprefixsql.
/// </summary>
public const string REMOVEBYPREFIXSQL = @"DELETE FROM [{0}].[{1}] WHERE [cachekey] like @cachekey AND [name]=@name";

/// <summary>
/// The existssql.
/// </summary>
public const string EXISTSSQL = @"SELECT COUNT(1)
FROM [{0}].[{1}]
WHERE [cachekey] = @cachekey AND [name]=@name AND [expiration] > getutcdate()";

/// <summary>
/// The countallsql.
/// </summary>
public const string COUNTALLSQL = @"SELECT COUNT(1)
FROM [{0}].[{1}]
WHERE [expiration] > getutcdate() AND [name]=@name";

/// <summary>
/// The countprefixsql.
/// </summary>
public const string COUNTPREFIXSQL = @"SELECT COUNT(1)
FROM [{0}].[{1}]
WHERE [cachekey] like @cachekey AND [name]=@name AND [expiration] > getutcdate()";

/// <summary>
/// The flushsql.
/// </summary>
public const string FLUSHSQL = @"DELETE FROM [{0}].[{1}] WHERE [name]=@name";

/// <summary>
/// The sql for cleaning up db. Remove all expired entries from the db.
/// </summary>
public const string CLEANEXPIREDSQL = @"DELETE FROM [{0}].[{1}] WHERE [expiration] < getutcdate()";

/// <summary>
/// The createsql.
/// </summary>
public const string CREATESQL = @"IF NOT EXISTS (
SELECT schema_name
FROM information_schema.schemata
WHERE schema_name = '{0}' )

BEGIN
EXEC sp_executesql N'CREATE SCHEMA {0}'
END

IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[{0}].[{1}]') AND type in (N'U'))
BEGIN
CREATE TABLE [{0}].[{1}] (
[ID] INT IDENTITY(1,1) PRIMARY KEY
, [name] VARCHAR(255)
, [cachekey] VARCHAR(255)
, [cachevalue] NVARCHAR(MAX)
, [expiration] DATETIME)
END";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using EasyCaching.Core;
using EasyCaching.Core.Configurations;
using Microsoft.Extensions.Configuration;

namespace EasyCaching.SQLServer.Configurations
{
/// <summary>
/// Easy caching options extensions.
/// </summary>
public static class EasyCachingOptionsExtensions
{
/// <summary>
/// Uses the SQLite.
/// </summary>
/// <returns>The SQL ite.</returns>
/// <param name="options">Options.</param>
/// <param name="configure">Configure.</param>
/// <param name="name">Name.</param>
public static EasyCachingOptions UseSQLServer(this EasyCachingOptions options, Action<SQLServerOptions> configure, string name = "")
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}

options.RegisterExtension(new SQLServerOptionsExtension(name, configure));
return options;
}

/// <summary>
/// Uses the SQLite.
/// </summary>
/// <returns>The SQL ite.</returns>
/// <param name="options">Options.</param>
/// <param name="configuration">Configuration.</param>
/// <param name="name">Name.</param>
/// <param name="sectionName">Section name.</param>
public static EasyCachingOptions UseSQLServer(this EasyCachingOptions options, IConfiguration configuration, string name = "", string sectionName = EasyCachingConstValue.SQLServerSection)
{
var dbConfig = configuration.GetSection(sectionName);
var serverOptions = new SQLServerOptions();
dbConfig.Bind(serverOptions);

void configure(SQLServerOptions x)
{
x.CachingProviderType = serverOptions.CachingProviderType;
x.EnableLogging = serverOptions.EnableLogging;
x.MaxRdSecond = serverOptions.MaxRdSecond;
x.Order = serverOptions.Order;
x.DBConfig = serverOptions.DBConfig;
}

options.RegisterExtension(new SQLServerOptionsExtension(name, configure));
return options;
}
}
}
Loading