Upgrade EntityFrameworkCore.BootKit to v8.5
This commit is contained in:
parent
e103cb86cb
commit
0abaa2df94
|
|
@ -170,7 +170,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Aspects.Cache" Version="2.0.4" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.3" />
|
||||
<PackageReference Include="EntityFrameworkCore.BootKit" Version="8.4.2" />
|
||||
<PackageReference Include="EntityFrameworkCore.BootKit" Version="8.5.0" />
|
||||
<PackageReference Include="Fluid.Core" Version="2.8.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public static class BotSharpCoreExtensions
|
|||
services.AddScoped<IBotSharpRepository>(sp =>
|
||||
{
|
||||
var myDatabaseSettings = sp.GetRequiredService<BotSharpDatabaseSettings>();
|
||||
return DataContextHelper.GetDbContext<BotSharpDbContext, DbContext4SqlServer>(myDatabaseSettings, sp);
|
||||
return DataContextHelper.GetSqlServerDbContext<BotSharpDbContext>(myDatabaseSettings, sp);
|
||||
});
|
||||
|
||||
return services;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
using Microsoft.Data.SqlClient;
|
||||
using MySqlConnector;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace BotSharp.Core.Repository;
|
||||
|
||||
public static class DataContextHelper
|
||||
{
|
||||
public static T GetDbContext<T, Tdb>(BotSharpDatabaseSettings settings, IServiceProvider serviceProvider)
|
||||
public static T GetSqlServerDbContext<T>(BotSharpDatabaseSettings settings, IServiceProvider serviceProvider)
|
||||
where T : Database, new()
|
||||
where Tdb : DataContext
|
||||
{
|
||||
if (settings.Assemblies == null)
|
||||
throw new Exception("Please set assemblies.");
|
||||
|
|
@ -18,32 +16,40 @@ public static class DataContextHelper
|
|||
var dc = new T();
|
||||
if (typeof(T) == typeof(BotSharpDbContext))
|
||||
{
|
||||
if (typeof(Tdb).Name.StartsWith("DbContext4SqlServer"))
|
||||
dc.BindDbContext<IBotSharpTable, DbContext4SqlServer>(new DatabaseBind
|
||||
{
|
||||
dc.BindDbContext<IBotSharpTable, Tdb>(new DatabaseBind
|
||||
{
|
||||
ServiceProvider = serviceProvider,
|
||||
MasterConnection = new SqlConnection(settings.BotSharp.Master),
|
||||
SlaveConnections = settings.BotSharp.Slavers.Length == 0 ?
|
||||
new List<DbConnection> { new SqlConnection(settings.BotSharp.Master) } :
|
||||
settings.BotSharp.Slavers.Select(x => new SqlConnection(x) as DbConnection)
|
||||
.ToList(),
|
||||
CreateDbIfNotExist = true
|
||||
});
|
||||
}
|
||||
else if (typeof(Tdb).Name.StartsWith("DbContext4Aurora") ||
|
||||
typeof(Tdb).Name.StartsWith("DbContext4MySql"))
|
||||
{
|
||||
dc.BindDbContext<IBotSharpTable, Tdb>(new DatabaseBind
|
||||
{
|
||||
ServiceProvider = serviceProvider,
|
||||
MasterConnection = new MySqlConnection(settings.BotSharp.Master),
|
||||
SlaveConnections = settings.BotSharp.Slavers
|
||||
.Select(x => new MySqlConnection(x) as DbConnection).ToList(),
|
||||
CreateDbIfNotExist = true
|
||||
});
|
||||
}
|
||||
ServiceProvider = serviceProvider,
|
||||
MasterConnection = new SqlConnection(settings.BotSharp.Master),
|
||||
SlaveConnections = settings.BotSharp.Slavers.Length == 0 ?
|
||||
new List<DbConnection> { new SqlConnection(settings.BotSharp.Master) } :
|
||||
settings.BotSharp.Slavers.Select(x => new SqlConnection(x) as DbConnection)
|
||||
.ToList(),
|
||||
CreateDbIfNotExist = true
|
||||
});
|
||||
}
|
||||
return dc;
|
||||
}
|
||||
|
||||
/*public static T GetMySqlDbContext<T>(BotSharpDatabaseSettings settings, IServiceProvider serviceProvider)
|
||||
where T : Database, new()
|
||||
{
|
||||
if (settings.Assemblies == null)
|
||||
throw new Exception("Please set assemblies.");
|
||||
|
||||
AppDomain.CurrentDomain.SetData("Assemblies", settings.Assemblies);
|
||||
|
||||
var dc = new T();
|
||||
if (typeof(T) == typeof(BotSharpDbContext))
|
||||
{
|
||||
dc.BindDbContext<IBotSharpTable, DbContext4MySql>(new DatabaseBind
|
||||
{
|
||||
ServiceProvider = serviceProvider,
|
||||
MasterConnection = new MySqlConnection(settings.BotSharp.Master),
|
||||
SlaveConnections = settings.BotSharp.Slavers
|
||||
.Select(x => new MySqlConnection(x) as DbConnection).ToList(),
|
||||
CreateDbIfNotExist = true
|
||||
});
|
||||
}
|
||||
return dc;
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.IO;
|
||||
using FunctionDef = BotSharp.Abstraction.Functions.Models.FunctionDef;
|
||||
using BotSharp.Abstraction.Users.Models;
|
||||
using MongoDB.Driver;
|
||||
using System.Text.Encodings.Web;
|
||||
using BotSharp.Abstraction.Plugins.Models;
|
||||
using BotSharp.Abstraction.Statistics.Settings;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
using Amazon.SecurityToken.Model.Internal.MarshallTransformations;
|
||||
using BotSharp.Abstraction.Agents.Models;
|
||||
using BotSharp.Abstraction.Functions.Models;
|
||||
using BotSharp.Abstraction.MLTasks;
|
||||
using BotSharp.Abstraction.Routing;
|
||||
using BotSharp.Abstraction.Routing.Models;
|
||||
using BotSharp.Abstraction.Routing.Planning;
|
||||
using BotSharp.Abstraction.Templating;
|
||||
using System.Drawing;
|
||||
|
||||
namespace BotSharp.Core.Routing.Planning;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
using BotSharp.Abstraction.Loggers.Models;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using SharpCompress.Compressors.Xz;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Mime;
|
||||
|
||||
namespace BotSharp.OpenAPI.Controllers;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Amazon.Runtime.Internal.Transform;
|
||||
using BotSharp.Abstraction.Agents.Enums;
|
||||
using BotSharp.Abstraction.MLTasks;
|
||||
using BotSharp.Core.Infrastructures;
|
||||
|
|
|
|||
Loading…
Reference in a new issue