feat: 改为 EFCore 工程

This commit is contained in:
zhangpeihang 2022-05-25 17:13:07 +08:00
parent ac707dd9ec
commit 9ad060d2c3
1 changed files with 15 additions and 14 deletions

View File

@ -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<BootstrapAppContext>();
// 增加 EFCore 数据服务
//services.AddEFCoreDataAccessServices((provider, option) =>
//{
// var configuration = provider.GetRequiredService<IConfiguration>();
// var connString = configuration.GetConnectionString("bb");
// option.UseSqlite(connString);
// option.EnableSensitiveDataLogging();
//});
services.AddEFCoreDataAccessServices((provider, option) =>
{
var configuration = provider.GetRequiredService<IConfiguration>();
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<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;
}