扩展服务集合,实现注册方法注册服务

This commit is contained in:
falcon 2020-12-12 10:09:42 +08:00
parent 2b8c470728
commit efc1fcd5d0
2 changed files with 20 additions and 6 deletions

View File

@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Falcon.StoredProcedureRunner", "Falcon.StoredProcedureRunner\Falcon.StoredProcedureRunner.csproj", "{13D3139B-60C2-4785-ADCB-4F839BDEC3C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Falcon.StoredProcedureRunner.Example", "Falcon.StoredProcedureRunner.Example\Falcon.StoredProcedureRunner.Example.csproj", "{3D5C85F0-94BF-487E-8418-B39FF3505262}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -17,10 +15,6 @@ Global
{13D3139B-60C2-4785-ADCB-4F839BDEC3C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13D3139B-60C2-4785-ADCB-4F839BDEC3C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13D3139B-60C2-4785-ADCB-4F839BDEC3C4}.Release|Any CPU.Build.0 = Release|Any CPU
{3D5C85F0-94BF-487E-8418-B39FF3505262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D5C85F0-94BF-487E-8418-B39FF3505262}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D5C85F0-94BF-487E-8418-B39FF3505262}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D5C85F0-94BF-487E-8418-B39FF3505262}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,20 @@
using Microsoft.Extensions.DependencyInjection;
namespace Falcon.StoredProcedureRunner
{
/// <summary>
/// 扩展服务集合注册接口
/// </summary>
public static class IServiceCollectionExtend
{
/// <summary>
/// 注册IRunner接口对象通过该接口可事先 对数据库存储过程模型化调用。
/// </summary>
/// <param name="services">注册服务集合</param>
/// <returns>服务集合</returns>
public static IServiceCollection UseFalconSPRunner(this IServiceCollection services) {
return services.AddSingleton<IRunner,Runner>();
}
}
}