feat:修改使用mysql
This commit is contained in:
@@ -57,7 +57,7 @@ namespace Yi.Framework.Core.Sqlsugar
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
SqlSugarClient = new SqlSugarScope(new ConnectionConfig()
|
||||
SqlSugarClient = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
//准备添加分表分库
|
||||
DbType = dbConnOptions.DbType ?? DbType.Sqlite,
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Yi.Framework.Data.DataSeeds
|
||||
/// <returns></returns>
|
||||
public virtual async Task<bool> IsInvoker()
|
||||
{
|
||||
var p = await _repository.IsAnyAsync(x=>true);
|
||||
var p2 = await _repository.CountAsync(x => true);
|
||||
if (await _repository.CountAsync(u => true) > 0)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Sqlsugar;
|
||||
using Yi.BBS.Domain;
|
||||
using Yi.RBAC.Sqlsugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
@@ -20,6 +21,7 @@ namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
|
||||
@@ -6,6 +6,7 @@ using Yi.BBS.Web;
|
||||
using Yi.Framework.Core.Module;
|
||||
using NLog.Extensions.Logging;
|
||||
using NLog;
|
||||
using SqlSugar;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); });
|
||||
@@ -23,7 +24,8 @@ builder.Host.ConfigureAutoFacContainer(container =>
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var db = app.Services.GetService<ISqlSugarClient>();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
app.UseErrorHandlingServer();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
|
||||
"DbConnOptions": {
|
||||
"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Sqlite",
|
||||
//"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Mysql",
|
||||
"EnabledDbSeed": true,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": true,
|
||||
|
||||
@@ -10,6 +10,7 @@ using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Sqlsugar;
|
||||
using Yi.BBS.Domain;
|
||||
using Yi.RBAC.Sqlsugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
@@ -20,6 +21,7 @@ namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
|
||||
@@ -6,6 +6,7 @@ using Yi.BBS.Web;
|
||||
using Yi.Framework.Core.Module;
|
||||
using NLog.Extensions.Logging;
|
||||
using NLog;
|
||||
using SqlSugar;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); });
|
||||
@@ -23,7 +24,8 @@ builder.Host.ConfigureAutoFacContainer(container =>
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var db = app.Services.GetService<ISqlSugarClient>();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
app.UseErrorHandlingServer();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
|
||||
"DbConnOptions": {
|
||||
"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Sqlite",
|
||||
//"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Mysql",
|
||||
"EnabledDbSeed": true,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": true,
|
||||
|
||||
Reference in New Issue
Block a user