feat: 开启 EFCore 服务
This commit is contained in:
parent
a549d87acd
commit
7eb06c1df6
|
@ -5,8 +5,8 @@ using BootstrapAdmin.Web.Services;
|
|||
using BootstrapAdmin.Web.Services.SMS;
|
||||
using BootstrapAdmin.Web.Services.SMS.Tencent;
|
||||
using BootstrapAdmin.Web.Utils;
|
||||
using PetaPoco;
|
||||
using PetaPoco.Providers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BootstrapBlazor.Components;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection
|
||||
{
|
||||
|
@ -51,12 +51,13 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
services.AddScoped<BootstrapAppContext>();
|
||||
|
||||
// 增加 EFCore 数据服务
|
||||
//services.AddEFCoreDataAccessServices((provider, option) =>
|
||||
//{
|
||||
// var configuration = provider.GetRequiredService<IConfiguration>();
|
||||
// var connString = configuration.GetConnectionString("bb");
|
||||
// option.UseSqlite(connString);
|
||||
//});
|
||||
services.AddEFCoreDataAccessServices((provider, option) =>
|
||||
{
|
||||
var configuration = provider.GetRequiredService<IConfiguration>();
|
||||
var connString = configuration.GetConnectionString("bb");
|
||||
option.UseSqlite(connString);
|
||||
option.EnableSensitiveDataLogging();
|
||||
});
|
||||
|
||||
// 增加 FreeSql 数据服务
|
||||
// services.AddFreeSql((provider, builder) =>
|
||||
|
@ -71,13 +72,13 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
// });
|
||||
|
||||
// 增加 PetaPoco 数据服务
|
||||
services.AddPetaPocoDataAccessServices((provider, builder) =>
|
||||
{
|
||||
var configuration = provider.GetRequiredService<IConfiguration>();
|
||||
var connString = configuration.GetConnectionString("bb");
|
||||
builder.UsingProvider<SQLiteDatabaseProvider>()
|
||||
.UsingConnectionString(connString);
|
||||
});
|
||||
//services.AddPetaPocoDataAccessServices((provider, builder) =>
|
||||
//{
|
||||
// var configuration = provider.GetRequiredService<IConfiguration>();
|
||||
// var connString = configuration.GetConnectionString("bb");
|
||||
// builder.UsingProvider<SQLiteDatabaseProvider>()
|
||||
// .UsingConnectionString(connString);
|
||||
//});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue