This commit is contained in:
@@ -14,7 +14,7 @@ using System.Linq;
|
||||
|
||||
namespace Dilon.EntityFramework.Core
|
||||
{
|
||||
[AppDbContext("DefaultConnection", DbProvider.Sqlite)]
|
||||
[AppDbContext("DefaultConnection", DbProvider.MySql)]
|
||||
public class DefaultDbContext : AppDbContext<DefaultDbContext>, IMultiTenantOnDatabase, IModelBuilderFilter
|
||||
{
|
||||
public DefaultDbContext(DbContextOptions<DefaultDbContext> options) : base(options)
|
||||
@@ -25,7 +25,15 @@ namespace Dilon.EntityFramework.Core
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite(GetDatabaseConnectionString());
|
||||
optionsBuilder.UseMySql(
|
||||
GetDatabaseConnectionString(),
|
||||
ServerVersion.FromString("5.5.53-mysql"),
|
||||
p => p.EnableRetryOnFailure(
|
||||
maxRetryCount: 5,
|
||||
maxRetryDelay: TimeSpan.FromSeconds(30),
|
||||
errorNumbersToAdd: new int[] { 2 }
|
||||
)
|
||||
);
|
||||
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.5" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0-alpha.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Data Source=./Dilon.db",
|
||||
//"DefaultConnection": "Data Source=./Dilon.db",
|
||||
"DefaultConnection": "Data Source=118.178.224.202;Database=dilon;User ID=root;Password=root;pooling=true;port=3306;sslmode=none;CharSet=utf8;",
|
||||
"PgSqlConnection": "HOST=127.0.0.1;PORT=5432;DATABASE=dilon;PASSWORD=postgres;USER ID=postgres;",
|
||||
"MultiTenantConnection": "Data Source=./Dilon_SaaS.db"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user