From 9ad060d2c376db76fcaac894f6733712cf9fbcda Mon Sep 17 00:00:00 2001 From: zhangpeihang <948869991@qq.com> Date: Wed, 25 May 2022 17:13:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B9=E4=B8=BA=20EFCore=20=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/ServiceCollectionExtensions.cs | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/blazor/admin/BootstrapAdmin.Web/Extensions/ServiceCollectionExtensions.cs b/src/blazor/admin/BootstrapAdmin.Web/Extensions/ServiceCollectionExtensions.cs index b2b30344..a2255a61 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Extensions/ServiceCollectionExtensions.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Extensions/ServiceCollectionExtensions.cs @@ -11,6 +11,7 @@ using BootstrapAdmin.Web.Services.SMS.Tencent; using BootstrapAdmin.Web.Utils; using PetaPoco; using PetaPoco.Providers; +using Microsoft.EntityFrameworkCore; namespace Microsoft.Extensions.DependencyInjection { @@ -52,13 +53,13 @@ namespace Microsoft.Extensions.DependencyInjection services.AddScoped(); // 增加 EFCore 数据服务 - //services.AddEFCoreDataAccessServices((provider, option) => - //{ - // var configuration = provider.GetRequiredService(); - // var connString = configuration.GetConnectionString("bb"); - // option.UseSqlite(connString); - // option.EnableSensitiveDataLogging(); - //}); + services.AddEFCoreDataAccessServices((provider, option) => + { + var configuration = provider.GetRequiredService(); + var connString = configuration.GetConnectionString("bb"); + option.UseSqlite(connString); + option.EnableSensitiveDataLogging(); + }); // 增加 FreeSql 数据服务 // services.AddFreeSql((provider, builder) => @@ -73,13 +74,13 @@ namespace Microsoft.Extensions.DependencyInjection // }); // 增加 PetaPoco 数据服务 - services.AddPetaPocoDataAccessServices((provider, builder) => - { - var configuration = provider.GetRequiredService(); - var connString = configuration.GetConnectionString("bb"); - builder.UsingProvider() - .UsingConnectionString(connString); - }); + //services.AddPetaPocoDataAccessServices((provider, builder) => + //{ + // var configuration = provider.GetRequiredService(); + // var connString = configuration.GetConnectionString("bb"); + // builder.UsingProvider() + // .UsingConnectionString(connString); + //}); return services; }