测试兼容mysql
This commit is contained in:
parent
d4ed14d313
commit
b9cef41cc2
|
@ -7,6 +7,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Falcon.Extend" Version="1.2.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" />
|
||||
|
|
|
@ -40,17 +40,18 @@ namespace FAuth
|
|||
//注册数据库
|
||||
services.AddDbContext<FAuthDb>(option => {
|
||||
//option.UseSqlServer(this.Configuration.GetValue<string>("Database:FAuthDbSqlServer"));
|
||||
var dbType = this.Configuration.GetValue<string>("Database:UseDb").ToLower();
|
||||
switch(dbType) {
|
||||
case "mysql":
|
||||
option.UseMySQL(this.Configuration.GetValue<string>("Database:FAuthDbMySql"));
|
||||
break;
|
||||
case "sqlserver":
|
||||
option.UseSqlServer(this.Configuration.GetValue<string>("Database:FAuthDbSqlServer"));
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Database:UseDbÅäÖôíÎó£¡Ö»ÄÜΪmysql»òsqlserver");
|
||||
}
|
||||
//var dbType = this.Configuration.GetValue<string>("Database:UseDb").ToLower();
|
||||
//switch(dbType) {
|
||||
// case "mysql":
|
||||
// option.UseMySQL(this.Configuration.GetValue<string>("Database:FAuthDbMySql"));
|
||||
// break;
|
||||
// case "sqlserver":
|
||||
// option.UseSqlServer(this.Configuration.GetValue<string>("Database:FAuthDbSqlServer"));
|
||||
// break;
|
||||
// default:
|
||||
// throw new Exception("Database:UseDbÅäÖôíÎó£¡Ö»ÄÜΪmysql»òsqlserver");
|
||||
//}
|
||||
});
|
||||
services.AddAccountHelper();
|
||||
//注册Redis
|
||||
|
|
Loading…
Reference in New Issue
Block a user