diff --git a/ShardingCore.sln b/ShardingCore.sln
index 9f646238..f482a917 100644
--- a/ShardingCore.sln
+++ b/ShardingCore.sln
@@ -7,20 +7,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{490FAE47-447
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore", "src\ShardingCore\ShardingCore.csproj", "{3CAF09A6-6ABD-41D9-BA57-9A822B8095F7}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.SqlServer", "src\ShardingCore.SqlServer\ShardingCore.SqlServer.csproj", "{2B65466D-D4F8-48FE-A516-014404414897}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src3x", "src3x", "{62AAE0FE-4099-4A48-AA3C-F76F14C62655}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.3x", "src3x\ShardingCore.3x\ShardingCore.3x.csproj", "{E0FDBFA9-AE5F-42FB-8A60-4E5D9E7D5414}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.SqlServer.3x", "src3x\ShardingCore.SqlServer.3x\ShardingCore.SqlServer.3x.csproj", "{37E11FFD-14D7-41B4-B04C-2950206C64DB}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src2x", "src2x", "{679E6084-0C45-4807-BFEE-D2FDA44B2188}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.2x", "src2x\ShardingCore.2x\ShardingCore.2x.csproj", "{FB92A4BE-A43E-4755-8132-EC38E9650B80}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.SqlServer.2x", "src2x\ShardingCore.SqlServer.2x\ShardingCore.SqlServer.2x.csproj", "{73B802A7-3DDE-4B02-9E3D-D6B9EE42DE5D}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CC2C88C0-65F2-445D-BE78-973B840FE281}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.Test50", "test\ShardingCore.Test50\ShardingCore.Test50.csproj", "{7EE133B6-5A02-41B7-9D89-41D9EA14184E}"
@@ -29,12 +23,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{EDF8
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.SqlServer", "samples\Sample.SqlServer\Sample.SqlServer.csproj", "{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.MySql", "src\ShardingCore.MySql\ShardingCore.MySql.csproj", "{10308339-FF5C-43AB-9208-627B6E2FBBDB}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.MySql.3x", "src3x\ShardingCore.MySql.3x\ShardingCore.MySql.3x.csproj", "{954C4CA2-9CF4-4C2C-8DE6-180DD8202E38}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.MySql.2x", "src2x\ShardingCore.MySql.2x\ShardingCore.MySql.2x.csproj", "{0CF88F0B-6CCB-49B5-B41D-CDC193B51581}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore.Test50.MySql", "test\ShardingCore.Test50.MySql\ShardingCore.Test50.MySql.csproj", "{C8FAB96F-F13E-4094-883C-2D38D39EE4A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AutoByDate.SqlServer", "samples\Samples.AutoByDate.SqlServer\Samples.AutoByDate.SqlServer.csproj", "{C34FCF48-1A98-4268-BFEE-6C9BFC7FD539}"
@@ -57,26 +45,14 @@ Global
{3CAF09A6-6ABD-41D9-BA57-9A822B8095F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CAF09A6-6ABD-41D9-BA57-9A822B8095F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CAF09A6-6ABD-41D9-BA57-9A822B8095F7}.Release|Any CPU.Build.0 = Release|Any CPU
- {2B65466D-D4F8-48FE-A516-014404414897}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2B65466D-D4F8-48FE-A516-014404414897}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2B65466D-D4F8-48FE-A516-014404414897}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2B65466D-D4F8-48FE-A516-014404414897}.Release|Any CPU.Build.0 = Release|Any CPU
{E0FDBFA9-AE5F-42FB-8A60-4E5D9E7D5414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0FDBFA9-AE5F-42FB-8A60-4E5D9E7D5414}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0FDBFA9-AE5F-42FB-8A60-4E5D9E7D5414}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0FDBFA9-AE5F-42FB-8A60-4E5D9E7D5414}.Release|Any CPU.Build.0 = Release|Any CPU
- {37E11FFD-14D7-41B4-B04C-2950206C64DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {37E11FFD-14D7-41B4-B04C-2950206C64DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {37E11FFD-14D7-41B4-B04C-2950206C64DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {37E11FFD-14D7-41B4-B04C-2950206C64DB}.Release|Any CPU.Build.0 = Release|Any CPU
{FB92A4BE-A43E-4755-8132-EC38E9650B80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB92A4BE-A43E-4755-8132-EC38E9650B80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB92A4BE-A43E-4755-8132-EC38E9650B80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB92A4BE-A43E-4755-8132-EC38E9650B80}.Release|Any CPU.Build.0 = Release|Any CPU
- {73B802A7-3DDE-4B02-9E3D-D6B9EE42DE5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {73B802A7-3DDE-4B02-9E3D-D6B9EE42DE5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {73B802A7-3DDE-4B02-9E3D-D6B9EE42DE5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {73B802A7-3DDE-4B02-9E3D-D6B9EE42DE5D}.Release|Any CPU.Build.0 = Release|Any CPU
{7EE133B6-5A02-41B7-9D89-41D9EA14184E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EE133B6-5A02-41B7-9D89-41D9EA14184E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EE133B6-5A02-41B7-9D89-41D9EA14184E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -85,18 +61,6 @@ Global
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}.Release|Any CPU.Build.0 = Release|Any CPU
- {10308339-FF5C-43AB-9208-627B6E2FBBDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {10308339-FF5C-43AB-9208-627B6E2FBBDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {10308339-FF5C-43AB-9208-627B6E2FBBDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {10308339-FF5C-43AB-9208-627B6E2FBBDB}.Release|Any CPU.Build.0 = Release|Any CPU
- {954C4CA2-9CF4-4C2C-8DE6-180DD8202E38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {954C4CA2-9CF4-4C2C-8DE6-180DD8202E38}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {954C4CA2-9CF4-4C2C-8DE6-180DD8202E38}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {954C4CA2-9CF4-4C2C-8DE6-180DD8202E38}.Release|Any CPU.Build.0 = Release|Any CPU
- {0CF88F0B-6CCB-49B5-B41D-CDC193B51581}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0CF88F0B-6CCB-49B5-B41D-CDC193B51581}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0CF88F0B-6CCB-49B5-B41D-CDC193B51581}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0CF88F0B-6CCB-49B5-B41D-CDC193B51581}.Release|Any CPU.Build.0 = Release|Any CPU
{C8FAB96F-F13E-4094-883C-2D38D39EE4A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8FAB96F-F13E-4094-883C-2D38D39EE4A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8FAB96F-F13E-4094-883C-2D38D39EE4A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -127,16 +91,10 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3CAF09A6-6ABD-41D9-BA57-9A822B8095F7} = {490FAE47-4476-4508-B216-505FC850447F}
- {2B65466D-D4F8-48FE-A516-014404414897} = {490FAE47-4476-4508-B216-505FC850447F}
{E0FDBFA9-AE5F-42FB-8A60-4E5D9E7D5414} = {62AAE0FE-4099-4A48-AA3C-F76F14C62655}
- {37E11FFD-14D7-41B4-B04C-2950206C64DB} = {62AAE0FE-4099-4A48-AA3C-F76F14C62655}
{FB92A4BE-A43E-4755-8132-EC38E9650B80} = {679E6084-0C45-4807-BFEE-D2FDA44B2188}
- {73B802A7-3DDE-4B02-9E3D-D6B9EE42DE5D} = {679E6084-0C45-4807-BFEE-D2FDA44B2188}
{7EE133B6-5A02-41B7-9D89-41D9EA14184E} = {CC2C88C0-65F2-445D-BE78-973B840FE281}
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
- {10308339-FF5C-43AB-9208-627B6E2FBBDB} = {490FAE47-4476-4508-B216-505FC850447F}
- {954C4CA2-9CF4-4C2C-8DE6-180DD8202E38} = {62AAE0FE-4099-4A48-AA3C-F76F14C62655}
- {0CF88F0B-6CCB-49B5-B41D-CDC193B51581} = {679E6084-0C45-4807-BFEE-D2FDA44B2188}
{C8FAB96F-F13E-4094-883C-2D38D39EE4A3} = {CC2C88C0-65F2-445D-BE78-973B840FE281}
{C34FCF48-1A98-4268-BFEE-6C9BFC7FD539} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
{90675788-D5C3-415A-9C18-FF159A75B4D5} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
diff --git a/samples/Sample.SqlServer/Sample.SqlServer.csproj b/samples/Sample.SqlServer/Sample.SqlServer.csproj
index 3b6947b1..14df3a81 100644
--- a/samples/Sample.SqlServer/Sample.SqlServer.csproj
+++ b/samples/Sample.SqlServer/Sample.SqlServer.csproj
@@ -5,8 +5,4 @@
9.0
-
-
-
-
diff --git a/src/ShardingCore.MySql/DIExtension.cs b/src/ShardingCore.MySql/DIExtension.cs
deleted file mode 100644
index 7ab9c605..00000000
--- a/src/ShardingCore.MySql/DIExtension.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Linq;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Update;
-using Microsoft.Extensions.DependencyInjection;
-using ShardingCore.Core.ShardingAccessors;
-using ShardingCore.Core.VirtualRoutes;
-using ShardingCore.Core.VirtualRoutes.TableRoutes;
-using ShardingCore.Core.VirtualTables;
-using ShardingCore.DbContexts;
-using ShardingCore.DbContexts.VirtualDbContexts;
-using ShardingCore.Extensions;
-using ShardingCore.MySql.EFCores;
-using ShardingCore.TableCreator;
-#if EFCORE2
-using Microsoft.EntityFrameworkCore.Query.Sql;
-#endif
-#if !EFCORE2
-using Microsoft.EntityFrameworkCore.Query;
-#endif
-
-
-namespace ShardingCore.MySql
-{
- /*
- * @Author: xjm
- * @Description:
- * @Date: 2020年4月7日 9:30:18
- * @Email: 326308290@qq.com
- */
- public static class DIExtension
- {
- public static IServiceCollection AddShardingMySql(this IServiceCollection services, Action configure)
- {
- if (configure == null)
- throw new ArgumentNullException($"AddScfSqlServerProvider :{nameof(configure)}");
-
- var options = new MySqlOptions();
- configure(options);
- services.AddSingleton(options);
- services.AddSingleton(sp => options);
- services.AddShardingCore();
-
- services.AddSingleton();
- services.AddSingleton();
-
- services.AddSingleton();
- return services;
- }
-
- internal static DbContextOptionsBuilder UseShardingMySqlQuerySqlGenerator(this DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.ReplaceService();
- return optionsBuilder;
- }
- internal static DbContextOptionsBuilder UseShardingMySqlQuerySqlGenerator(this DbContextOptionsBuilder optionsBuilder) where TContext:DbContext
- {
- optionsBuilder.ReplaceService();
- return optionsBuilder;
- }
- public static DbContextOptionsBuilder UseShardingMySqlUpdateSqlGenerator(this DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.ReplaceService();
- return optionsBuilder;
- }
- public static DbContextOptionsBuilder UseShardingMySqlUpdateSqlGenerator(this DbContextOptionsBuilder optionsBuilder) where TContext:DbContext
- {
- optionsBuilder.ReplaceService();
- return optionsBuilder;
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.MySql/EFCores/ShardingMySqlQuerySqlGenerator.cs b/src/ShardingCore.MySql/EFCores/ShardingMySqlQuerySqlGenerator.cs
deleted file mode 100644
index 9e7f897b..00000000
--- a/src/ShardingCore.MySql/EFCores/ShardingMySqlQuerySqlGenerator.cs
+++ /dev/null
@@ -1,213 +0,0 @@
-#if !EFCORE2
-using System;
-using System.Linq;
-using System.Linq.Expressions;
-using Microsoft.EntityFrameworkCore.Query;
-using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.Extensions.DependencyInjection;
-using Pomelo.EntityFrameworkCore.MySql.Infrastructure.Internal;
-using Pomelo.EntityFrameworkCore.MySql.Query.ExpressionVisitors.Internal;
-using Pomelo.EntityFrameworkCore.MySql.Query.Internal;
-using ShardingCore.Core.ShardingAccessors;
-using ShardingCore.Core.VirtualTables;
-using ShardingCore.Extensions;
-
-namespace ShardingCore.MySql.EFCores
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Tuesday, 22 December 2020 09:47:59
-* @Email: 326308290@qq.com
-*/
- public class ShardingMySqlQuerySqlGeneratorFactory : IQuerySqlGeneratorFactory
- {
-
- private readonly QuerySqlGeneratorDependencies _dependencies;
- private readonly MySqlSqlExpressionFactory _sqlExpressionFactory;
- private readonly IMySqlOptions _options;
-
- public ShardingMySqlQuerySqlGeneratorFactory(
- QuerySqlGeneratorDependencies dependencies,
- ISqlExpressionFactory sqlExpressionFactory,
- IMySqlOptions options)
- {
- this._dependencies = dependencies;
- this._sqlExpressionFactory = (MySqlSqlExpressionFactory) sqlExpressionFactory;
- this._options = options;
- }
-
- public virtual QuerySqlGenerator Create() => (QuerySqlGenerator) new ShardingMySqlQuerySqlGenerator(this._dependencies, this._sqlExpressionFactory, this._options);
- }
-
- public class ShardingMySqlQuerySqlGenerator :MySqlQuerySqlGenerator
- {
- public ShardingMySqlQuerySqlGenerator(QuerySqlGeneratorDependencies dependencies, MySqlSqlExpressionFactory sqlExpressionFactory, IMySqlOptions options) : base(dependencies, sqlExpressionFactory, options)
- {
- }
- protected override Expression VisitTable(TableExpression tableExpression)
- {
- return OverrideVisitTable(tableExpression);
- // this._relationalCommandBuilder.Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Name, tableExpression.Schema)).Append((object) this.AliasSeparator).Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- // return (Expression) tableExpression;
-
- // typeof(TableExpression)
- // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name.Contains(nameof(tableExpression.Name)))
- // .SetValue(tableExpression,"(select * from Log_1Message union all select * from Log_1Message)");
-
- // base will append schema, table and alias
- }
-
- private Expression OverrideVisitTable(TableExpression tableExpression)
- {
- var shardingAccessor = ShardingContainer.Services.GetService();
- if (shardingAccessor?.ShardingContext != null)
- {
- var virtualTableManager = ShardingContainer.Services.GetService();
- var virtualTable = virtualTableManager.GetAllVirtualTables().FirstOrDefault(o => o.GetOriginalTableName() == tableExpression.Name);
- if(virtualTable!=null)
- {
- var tails = shardingAccessor.ShardingContext.GetContextQueryTails(virtualTable);
- var tailPrefix = virtualTable.ShardingConfig.TailPrefix;
- string newTableName = null;
- var sqlGenerationHelper = typeof(QuerySqlGenerator).GetTypeFieldValue(this, "_sqlGenerationHelper") as ISqlGenerationHelper;
-
- if (tails.IsEmpty())
- {
- var firstTail = virtualTableManager.GetVirtualTable(tableExpression.Name).GetAllPhysicTables()[0].Tail;
- newTableName = $"( select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Name}{tailPrefix}{firstTail}", tableExpression.Schema)} where 1=2 )";
- }
- else if (tails.Count == 1)
- {
- //对tableExpresion进行重写
- //typeof(TableExpression)
- // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name==$"<{nameof(tableExpression.Name)}>k__BackingField")
- // .SetValue(tableExpression,$"{tableExpression.Name}{tailPrefix}{entry.Tails[0]}");
- newTableName = sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Name}{tailPrefix}{tails[0]}", tableExpression.Schema);
- }
- else
- {
- newTableName = "(" + string.Join(" union all ", tails.Select(tail => $"select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Name}{tailPrefix}{tail}", tableExpression.Schema)}")) + ")";
- }
- var relationalCommandBuilder = typeof(QuerySqlGenerator).GetTypeFieldValue(this, "_relationalCommandBuilder") as IRelationalCommandBuilder;
- relationalCommandBuilder.Append(newTableName).Append(this.AliasSeparator).Append(sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- return tableExpression;
- }
- }
-
- var result = base.VisitTable(tableExpression);
- return result;
- }
-
- }
-}
-#endif
-
-#if EFCORE2
-using System;
-using System.Linq;
-using System.Linq.Expressions;
-using ShardingCore;
-using ShardingCore.Extensions;
-using ShardingCore.Core.ShardingAccessors;
-using ShardingCore.Core.VirtualTables;
-using Microsoft.EntityFrameworkCore.Query.Expressions;
-using Microsoft.EntityFrameworkCore.Query.Sql;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.Extensions.DependencyInjection;
-using Pomelo.EntityFrameworkCore.MySql.Infrastructure.Internal;
-using Pomelo.EntityFrameworkCore.MySql.Query.Sql.Internal;
-
-namespace ShardingCore.MySql.EFCores
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Tuesday, 22 December 2020 09:47:59
-* @Email: 326308290@qq.com
-*/
- public class ShardingMySqlQuerySqlGeneratorFactory :QuerySqlGeneratorFactoryBase
- {
-
- private readonly IMySqlOptions _options;
-
- public ShardingMySqlQuerySqlGeneratorFactory(QuerySqlGeneratorDependencies dependencies, IMySqlOptions options)
- : base(dependencies)
- {
- _options = options;
- }
-
- public override IQuerySqlGenerator CreateDefault(SelectExpression selectExpression)
- => new ShardingMySqlQuerySqlGenerator(
- Dependencies,
- selectExpression, _options);
- }
-
- public class ShardingMySqlQuerySqlGenerator : MySqlQuerySqlGenerator
- {
-
- public ShardingMySqlQuerySqlGenerator(QuerySqlGeneratorDependencies dependencies, SelectExpression selectExpression, IMySqlOptions options) : base(dependencies, selectExpression, options)
- {
- }
-
- public override Expression VisitTable(TableExpression tableExpression)
- {
- return OverrideVisitTable(tableExpression);
- }
- // protected override Expression VisitTable(TableExpression tableExpression)
- // {
- // return OverrideVisitTable(tableExpression);
- // // this._relationalCommandBuilder.Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Name, tableExpression.Schema)).Append((object) this.AliasSeparator).Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- // // return (Expression) tableExpression;
- //
- // // typeof(TableExpression)
- // // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name.Contains(nameof(tableExpression.Name)))
- // // .SetValue(tableExpression,"(select * from Log_1Message union all select * from Log_1Message)");
- //
- // // base will append schema, table and alias
- // }
-
- private Expression OverrideVisitTable(TableExpression tableExpression)
- {
- var shardingAccessor = ShardingContainer.Services.GetService();
- if (shardingAccessor?.ShardingContext != null)
- {
- var virtualTableManager = ShardingContainer.Services.GetService();
- var virtualTable = virtualTableManager.GetAllVirtualTables().FirstOrDefault(o => o.GetOriginalTableName() == tableExpression.Table);
- if(virtualTable!=null)
- {
- var tails = shardingAccessor.ShardingContext.GetContextQueryTails(virtualTable);
- var tailPrefix = virtualTable.ShardingConfig.TailPrefix;
- string newTableName = null;
- var sqlGenerationHelper = typeof(DefaultQuerySqlGenerator).GetTypePropertyValue(this, "SqlGenerator") as ISqlGenerationHelper;
-
- if (tails.IsEmpty())
- {
- var firstTail = virtualTableManager.GetVirtualTable(tableExpression.Table).GetAllPhysicTables()[0].Tail;
- newTableName = $"( select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Table}{tailPrefix}{firstTail}", tableExpression.Schema)} where 1=2 )";
- }
- else if (tails.Count == 1)
- {
- //对tableExpresion进行重写
- //typeof(TableExpression)
- // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name==$"<{nameof(tableExpression.Name)}>k__BackingField")
- // .SetValue(tableExpression,$"{tableExpression.Name}{tailPrefix}{entry.Tails[0]}");
- newTableName = sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Table}{tailPrefix}{tails[0]}", tableExpression.Schema);
- }
- else
- {
- newTableName = "(" + string.Join(" union all ", tails.Select(tail => $"select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Table}{tailPrefix}{tail}", tableExpression.Schema)}")) + ")";
- }
-
- var relationalCommandBuilder = typeof(DefaultQuerySqlGenerator).GetTypeFieldValue(this, "_relationalCommandBuilder") as IRelationalCommandBuilder;
- relationalCommandBuilder.Append(newTableName).Append(this.AliasSeparator).Append(sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- return tableExpression;
- }
- }
- var result = base.VisitTable(tableExpression);
- return result;
- }
- }
-}
-#endif
\ No newline at end of file
diff --git a/src/ShardingCore.MySql/EFCores/ShardingMySqlUpdateSqlGenerator.cs b/src/ShardingCore.MySql/EFCores/ShardingMySqlUpdateSqlGenerator.cs
deleted file mode 100644
index e4cba57e..00000000
--- a/src/ShardingCore.MySql/EFCores/ShardingMySqlUpdateSqlGenerator.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.EntityFrameworkCore.Update;
-using Microsoft.Extensions.DependencyInjection;
-using Pomelo.EntityFrameworkCore.MySql.Update.Internal;
-using ShardingCore.Core.VirtualRoutes.TableRoutes;
-using ShardingCore.Core.VirtualTables;
-using ShardingCore.Exceptions;
-
-namespace ShardingCore.MySql.EFCores
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Friday, 23 July 2021 23:25:20
-* @Email: 326308290@qq.com
-*/
- public class ShardingMySqlUpdateSqlGenerator:MySqlUpdateSqlGenerator
- {
- public ShardingMySqlUpdateSqlGenerator(UpdateSqlGeneratorDependencies dependencies) : base(dependencies)
- {
- }
-
- public override ResultSetMapping AppendInsertOperation(StringBuilder commandStringBuilder, ModificationCommand command, int commandPosition)
- {
- // Check.NotNull(commandStringBuilder, nameof(commandStringBuilder));
- // Check.NotNull(command, nameof(command));
- var virtualTableManager = ShardingContainer.Services.GetService();
-
- var name = command.TableName;
- var schema = command.Schema;
-
- var operations = command.ColumnModifications;
- var tryGetVirtualTable = virtualTableManager.TryGetVirtualTable(name);
- if (tryGetVirtualTable != null)
- {
- var shardingEntityConfig = tryGetVirtualTable.ShardingConfig;
- var shardingCol = operations.FirstOrDefault(o=>o.Property.Name.Equals(shardingEntityConfig.ShardingField));
- if (shardingCol == null)
- throw new ShardingKeyRouteNotMatchException();
- // shardingEntityConfig.ShardingField
- var physicTables = tryGetVirtualTable.RouteTo(new TableRouteConfig(null,null,shardingCol.Value));
- name = physicTables[0].FullName;
- }
-
- var writeOperations = operations.Where(o => o.IsWrite).ToList();
- var readOperations = operations.Where(o => o.IsRead).ToList();
-
- AppendInsertCommand(commandStringBuilder, name, schema, writeOperations);
-
- if (readOperations.Count > 0)
- {
- var keyOperations = operations.Where(o => o.IsKey).ToList();
-
- return AppendSelectAffectedCommand(commandStringBuilder, name, schema, readOperations, keyOperations, commandPosition);
- }
-
- return ResultSetMapping.NoResultSet;
- }
-
- public override ResultSetMapping AppendUpdateOperation(StringBuilder commandStringBuilder, ModificationCommand command, int commandPosition)
- {
- // Check.NotNull(commandStringBuilder, nameof(commandStringBuilder));
- // Check.NotNull(command, nameof(command));
-
- var name = command.TableName;
- var schema = command.Schema;
- var operations = command.ColumnModifications;
-
- var virtualTableManager = ShardingContainer.Services.GetService();
- var tryGetVirtualTable = virtualTableManager.TryGetVirtualTable(name);
- if (tryGetVirtualTable != null)
- {
- var shardingEntityConfig = tryGetVirtualTable.ShardingConfig;
- var shardingCol = operations.FirstOrDefault(o=>o.IsRead&&o.Property.Name.Equals(shardingEntityConfig.ShardingField));
- if (shardingCol == null)
- throw new ShardingKeyRouteNotMatchException();
- // shardingEntityConfig.ShardingField
- var physicTables = tryGetVirtualTable.RouteTo(new TableRouteConfig(null,null,shardingCol.Value));
- name = physicTables[0].FullName;
- }
-
-
- var writeOperations = operations.Where(o => o.IsWrite).ToList();
- var conditionOperations = operations.Where(o => o.IsCondition).ToList();
- var readOperations = operations.Where(o => o.IsRead).ToList();
-
- AppendUpdateCommand(commandStringBuilder, name, schema, writeOperations, conditionOperations);
-
- if (readOperations.Count > 0)
- {
- var keyOperations = operations.Where(o => o.IsKey).ToList();
-
- return AppendSelectAffectedCommand(commandStringBuilder, name, schema, readOperations, keyOperations, commandPosition);
- }
-
- return AppendSelectAffectedCountCommand(commandStringBuilder, name, schema, commandPosition);
- }
-
- public override ResultSetMapping AppendDeleteOperation(StringBuilder commandStringBuilder, ModificationCommand command, int commandPosition)
- {
- // Check.NotNull(commandStringBuilder, nameof (commandStringBuilder));
- // Check.NotNull(command, nameof (command));
-
- var name = command.TableName;
- var schema = command.Schema;
- var conditionOperations = command.ColumnModifications.Where(o => o.IsCondition).ToList();
-
- var virtualTableManager = ShardingContainer.Services.GetService();
- var tryGetVirtualTable = virtualTableManager.TryGetVirtualTable(name);
- if (tryGetVirtualTable != null)
- {
- var shardingEntityConfig = tryGetVirtualTable.ShardingConfig;
- var shardingCol = command.ColumnModifications.FirstOrDefault(o=>o.IsRead&&o.Property.Name.Equals(shardingEntityConfig.ShardingField));
- if (shardingCol == null)
- throw new ShardingKeyRouteNotMatchException();
- // shardingEntityConfig.ShardingField
- var physicTables = tryGetVirtualTable.RouteTo(new TableRouteConfig(null,null,shardingCol.Value));
- name = physicTables[0].FullName;
- }
- AppendDeleteCommand(commandStringBuilder, name, schema, conditionOperations);
-
- return AppendSelectAffectedCountCommand(commandStringBuilder, name, schema, commandPosition);
- }
-
- public override ResultSetMapping AppendBulkInsertOperation(StringBuilder commandStringBuilder, IReadOnlyList modificationCommands, int commandPosition)
- {
- return base.AppendBulkInsertOperation(commandStringBuilder, modificationCommands, commandPosition);
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.MySql/MySqlDbContextOptionsProvider.cs b/src/ShardingCore.MySql/MySqlDbContextOptionsProvider.cs
deleted file mode 100644
index 893d31e5..00000000
--- a/src/ShardingCore.MySql/MySqlDbContextOptionsProvider.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Data.Common;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.Extensions.Logging;
-#if !EFCORE5
-using MySql.Data.MySqlClient;
-#endif
-#if EFCORE5
-using MySqlConnector;
-#endif
-using ShardingCore.DbContexts.VirtualDbContexts;
-using ShardingCore.EFCores;
-using ShardingCore.Extensions;
-
-namespace ShardingCore.MySql
-{
- /*
- * @Author: xjm
- * @Description:
- * @Date: Thursday, 24 December 2020 10:33:51
- * @Email: 326308290@qq.com
- */
- public class MySqlDbContextOptionsProvider:IDbContextOptionsProvider
- {
- private readonly MySqlOptions _mySqlOptions;
- private readonly ILoggerFactory _loggerFactory;
- private readonly IShardingCoreOptions _shardingCoreOptions;
-
- public MySqlDbContextOptionsProvider(MySqlOptions mySqlOptions,ILoggerFactory loggerFactory,IShardingCoreOptions shardingCoreOptions)
- {
- _mySqlOptions = mySqlOptions;
- _loggerFactory = loggerFactory;
- _shardingCoreOptions = shardingCoreOptions;
- }
- public DbContextOptions GetDbContextOptions(DbConnection dbConnection)
- {
-
- var track = dbConnection != null;
- var connection = dbConnection ?? GetMySqlConnection();
- var dbContextOptions= CreateDbContextOptionBuilder()
-#if EFCORE5
- .UseMySql(connection, _mySqlOptions.ServerVersion, _mySqlOptions.MySqlOptionsAction)
-#endif
-#if !EFCORE5
- .UseMySql(connection, _mySqlOptions.MySqlOptionsAction)
-#endif
- .IfDo(!track, o => o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking))
- .UseLoggerFactory(_loggerFactory)
- //.ReplaceService()
- .ReplaceService()
- .ReplaceService()
- //.UseShardingMySqlQuerySqlGenerator()
- .Options;
- return dbContextOptions;
- }
- private MySqlConnection GetMySqlConnection()
- {
- var connectionString = _shardingCoreOptions.GetShardingConfig().ConnectionString;
- return new MySqlConnection(connectionString);
- }
- private DbContextOptionsBuilder CreateDbContextOptionBuilder()
- {
- var shardingConfigEntry = _shardingCoreOptions.GetShardingConfig();
- Type type = typeof(DbContextOptionsBuilder<>);
- type = type.MakeGenericType(shardingConfigEntry.DbContextType);
- return (DbContextOptionsBuilder)Activator.CreateInstance(type);
- }
-
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.MySql/MySqlOptions.cs b/src/ShardingCore.MySql/MySqlOptions.cs
deleted file mode 100644
index 6ba020b6..00000000
--- a/src/ShardingCore.MySql/MySqlOptions.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-
-namespace ShardingCore.MySql
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: 2020年4月7日 8:34:04
-* @Email: 326308290@qq.com
-*/
- public class MySqlOptions: AbstractShardingCoreOptions
- {
-#if EFCORE5
- public MySqlServerVersion ServerVersion { get; set; }
-#endif
-
- public Action MySqlOptionsAction { get; set; }
-
- public void SetMySqlOptions(Action action)
- {
- MySqlOptionsAction = action;
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.MySql/ShardingCore.MySql.csproj b/src/ShardingCore.MySql/ShardingCore.MySql.csproj
deleted file mode 100644
index 1d30a6ff..00000000
--- a/src/ShardingCore.MySql/ShardingCore.MySql.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- netstandard2.1
- $(EFCORE5)
- true
- TRACE;DEBUG;EFCORE5;
- 8.0
-
-
- true
- bin\Release\ShardingCore.MySql.xml
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ShardingCore.MySql/ShardingMySqlParallelDbContextFactory.cs b/src/ShardingCore.MySql/ShardingMySqlParallelDbContextFactory.cs
deleted file mode 100644
index 382d1baf..00000000
--- a/src/ShardingCore.MySql/ShardingMySqlParallelDbContextFactory.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Query.Internal;
-using ShardingCore.Core.VirtualTables;
-using ShardingCore.DbContexts;
-using ShardingCore.DbContexts.ShardingDbContexts;
-using ShardingCore.EFCores;
-using ShardingCore.Extensions;
-
-namespace ShardingCore.MySql
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Tuesday, 29 December 2020 15:22:50
-* @Email: 326308290@qq.com
-*/
- public class ShardingMySqlParallelDbContextFactory : IShardingParallelDbContextFactory
- {
- private readonly IVirtualTableManager _virtualTableManager;
- private readonly IShardingDbContextFactory _shardingDbContextFactory;
- private readonly IShardingCoreOptions _shardingCoreOptions;
- private readonly MySqlOptions _mySqlOptions;
-
- public ShardingMySqlParallelDbContextFactory(IVirtualTableManager virtualTableManager,IShardingDbContextFactory shardingDbContextFactory,IShardingCoreOptions shardingCoreOptions, MySqlOptions mySqlOptions)
- {
- _virtualTableManager = virtualTableManager;
- _shardingDbContextFactory = shardingDbContextFactory;
- _shardingCoreOptions = shardingCoreOptions;
- _mySqlOptions = mySqlOptions;
- }
-
- public DbContext Create(string tail)
- {
- var shardingConfigEntry = _shardingCoreOptions.GetShardingConfig();
- var shardingDbContextOptions = new ShardingDbContextOptions(CreateOptions(shardingConfigEntry.ConnectionString), tail);
- return _shardingDbContextFactory.Create(shardingDbContextOptions);
- }
-
- private DbContextOptions CreateOptions(string connectionString)
- {
- return CreateDbContextOptionBuilder()
-#if EFCORE5
- .UseMySql(connectionString,_mySqlOptions.ServerVersion,_mySqlOptions.MySqlOptionsAction)
-#endif
-#if !EFCORE5
-
- .UseMySql(connectionString, _mySqlOptions.MySqlOptionsAction)
-#endif
- .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking)
- .ReplaceService()
- .ReplaceService()
- .ReplaceService()
- .UseShardingMySqlQuerySqlGenerator()
- .Options;
- }
- private DbContextOptionsBuilder CreateDbContextOptionBuilder()
- {
- var shardingConfigEntry = _shardingCoreOptions.GetShardingConfig();
- Type type = typeof(DbContextOptionsBuilder<>);
- type = type.MakeGenericType(shardingConfigEntry.DbContextType);
- return (DbContextOptionsBuilder)Activator.CreateInstance(type);
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.SqlServer/DIExtension.cs b/src/ShardingCore.SqlServer/DIExtension.cs
deleted file mode 100644
index 16ae2ea7..00000000
--- a/src/ShardingCore.SqlServer/DIExtension.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Internal;
-using Microsoft.EntityFrameworkCore.Query;
-using Microsoft.EntityFrameworkCore.Query.Internal;
-using Microsoft.Extensions.DependencyInjection;
-using ShardingCore.DbContexts;
-using ShardingCore.DbContexts.VirtualDbContexts;
-using ShardingCore.EFCores;
-using ShardingCore.Sharding;
-using ShardingCore.SqlServer.EFCores;
-using System;
-
-#if EFCORE2
-using Microsoft.EntityFrameworkCore.Query.Sql;
-#endif
-
-namespace ShardingCore.SqlServer
-{
- /*
- * @Author: xjm
- * @Description:
- * @Date: 2020年4月7日 9:30:18
- * @Email: 326308290@qq.com
- */
- public static class DIExtension
- {
- public static IServiceCollection AddShardingSqlServer(this IServiceCollection services, Action configure)
- {
- if (configure == null)
- throw new ArgumentNullException($"AddScfSqlServerProvider 参数不能为空:{nameof(configure)}");
-
- var options = new SqlServerOptions();
- configure(options);
- services.AddSingleton(sp=> options);
- services.AddShardingCore();
-
- services.AddSingleton();
- services.AddSingleton();
-
- services.AddSingleton();
- return services;
- }
-
- internal static DbContextOptionsBuilder UseShardingSqlServerQuerySqlGenerator(this DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.ReplaceService();
- return optionsBuilder;
- }
- internal static DbContextOptionsBuilder UseShardingSqlServerQuerySqlGenerator(this DbContextOptionsBuilder optionsBuilder) where TContext : DbContext
- {
- optionsBuilder.ReplaceService();
- return optionsBuilder;
- }
-
-
- public static DbContextOptionsBuilder UseSharding(this DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.ReplaceService().ReplaceService();
- return optionsBuilder;
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.SqlServer/EFCores/ShardingSqlServerQuerySqlGenerator.cs b/src/ShardingCore.SqlServer/EFCores/ShardingSqlServerQuerySqlGenerator.cs
deleted file mode 100644
index 21d59df8..00000000
--- a/src/ShardingCore.SqlServer/EFCores/ShardingSqlServerQuerySqlGenerator.cs
+++ /dev/null
@@ -1,214 +0,0 @@
-#if !EFCORE2
-using System.Linq;
-using System.Linq.Expressions;
-using Microsoft.EntityFrameworkCore.Query;
-using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
-using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.Extensions.DependencyInjection;
-using ShardingCore.Core.ShardingAccessors;
-using ShardingCore.Core.VirtualTables;
-using ShardingCore.Extensions;
-
-namespace ShardingCore.SqlServer.EFCores
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Tuesday, 22 December 2020 09:47:59
-* @Email: 326308290@qq.com
-*/
- public class ShardingSqlServerQuerySqlGeneratorFactory : IQuerySqlGeneratorFactory
- {
- public ShardingSqlServerQuerySqlGeneratorFactory(QuerySqlGeneratorDependencies dependencies)
- {
- Dependencies = dependencies;
- }
-
- public QuerySqlGeneratorDependencies Dependencies { get; }
- public QuerySqlGenerator Create() => new ShardingSqlServerQuerySqlGenerator(Dependencies);
- }
-
- public class ShardingSqlServerQuerySqlGenerator : SqlServerQuerySqlGenerator
- {
- public ShardingSqlServerQuerySqlGenerator(QuerySqlGeneratorDependencies dependencies)
- : base(dependencies)
- {
- }
-
- protected override Expression VisitTable(TableExpression tableExpression)
- {
- return OverrideVisitTable(tableExpression);
- // this._relationalCommandBuilder.Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Name, tableExpression.Schema)).Append((object) this.AliasSeparator).Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- // return (Expression) tableExpression;
-
- // typeof(TableExpression)
- // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name.Contains(nameof(tableExpression.Name)))
- // .SetValue(tableExpression,"(select * from Log_1Message union all select * from Log_1Message)");
-
- // base will append schema, table and alias
- }
-
- private Expression OverrideVisitTable(TableExpression tableExpression)
- {
- var shardingAccessor = ShardingContainer.Services.GetService();
- if (shardingAccessor?.ShardingContext != null)
- {
- var virtualTableManager = ShardingContainer.Services.GetService();
- var virtualTable = virtualTableManager.GetAllVirtualTables().FirstOrDefault(o => o.GetOriginalTableName() == tableExpression.Name);
- if(virtualTable!=null)
- {
- var tails = shardingAccessor.ShardingContext.GetContextQueryTails(virtualTable);
- var tailPrefix = virtualTable.ShardingConfig.TailPrefix;
- string newTableName = null;
- var sqlGenerationHelper = typeof(QuerySqlGenerator).GetTypeFieldValue(this, "_sqlGenerationHelper") as ISqlGenerationHelper;
-
- if (tails.IsEmpty())
- {
- var firstTail = virtualTableManager.GetVirtualTable(tableExpression.Name).GetAllPhysicTables()[0].Tail;
- newTableName = $"( select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Name}{tailPrefix}{firstTail}", tableExpression.Schema)} where 1=2 )";
- }
- else if (tails.Count == 1)
- {
- //对tableExpresion进行重写
- //typeof(TableExpression)
- // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name==$"<{nameof(tableExpression.Name)}>k__BackingField")
- // .SetValue(tableExpression,$"{tableExpression.Name}{tailPrefix}{entry.Tails[0]}");
- newTableName = sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Name}{tailPrefix}{tails[0]}", tableExpression.Schema);
- }
- else
- {
- newTableName = "(" + string.Join(" union all ", tails.Select(tail => $"select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Name}{tailPrefix}{tail}", tableExpression.Schema)}")) + ")";
- }
-
- var relationalCommandBuilder = typeof(QuerySqlGenerator).GetTypeFieldValue(this, "_relationalCommandBuilder") as IRelationalCommandBuilder;
- relationalCommandBuilder.Append(newTableName).Append(this.AliasSeparator).Append(sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- return tableExpression;
- }
- }
-
- var result = base.VisitTable(tableExpression);
- return result;
- }
- }
-}
-#endif
-
-#if EFCORE2
-using System.Linq;
-using System.Linq.Expressions;
-using ShardingCore;
-using ShardingCore.Extensions;
-using ShardingCore.Core.ShardingAccessors;
-using ShardingCore.Core.VirtualTables;
-using Microsoft.EntityFrameworkCore.Query.Expressions;
-using Microsoft.EntityFrameworkCore.Query.Sql;
-using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal;
-using Microsoft.EntityFrameworkCore.SqlServer.Query.Sql.Internal;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace ShardingCore.SqlServer.EFCores
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Tuesday, 22 December 2020 09:47:59
-* @Email: 326308290@qq.com
-*/
- public class ShardingSqlServerQuerySqlGeneratorFactory :QuerySqlGeneratorFactoryBase
- {
-
- private readonly ISqlServerOptions _sqlServerOptions;
-
- ///
- /// This API supports the Entity Framework Core infrastructure and is not intended to be used
- /// directly from your code. This API may change or be removed in future releases.
- ///
- public ShardingSqlServerQuerySqlGeneratorFactory(
- QuerySqlGeneratorDependencies dependencies,
- ISqlServerOptions sqlServerOptions)
- : base(dependencies)
- {
- _sqlServerOptions = sqlServerOptions;
- }
-
- ///
- /// This API supports the Entity Framework Core infrastructure and is not intended to be used
- /// directly from your code. This API may change or be removed in future releases.
- ///
- public override IQuerySqlGenerator CreateDefault(SelectExpression selectExpression)
- => new ShardingSqlServerQuerySqlGenerator(
- Dependencies,
- selectExpression,
- _sqlServerOptions.RowNumberPagingEnabled);
- }
-
- public class ShardingSqlServerQuerySqlGenerator : SqlServerQuerySqlGenerator
- {
-
- public ShardingSqlServerQuerySqlGenerator(QuerySqlGeneratorDependencies dependencies, SelectExpression selectExpression, bool rowNumberPagingEnabled) : base(dependencies, selectExpression, rowNumberPagingEnabled)
- {
- }
-
- public override Expression VisitTable(TableExpression tableExpression)
- {
- return OverrideVisitTable(tableExpression);
- }
- // protected override Expression VisitTable(TableExpression tableExpression)
- // {
- // return OverrideVisitTable(tableExpression);
- // // this._relationalCommandBuilder.Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Name, tableExpression.Schema)).Append((object) this.AliasSeparator).Append((object) this._sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- // // return (Expression) tableExpression;
- //
- // // typeof(TableExpression)
- // // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name.Contains(nameof(tableExpression.Name)))
- // // .SetValue(tableExpression,"(select * from Log_1Message union all select * from Log_1Message)");
- //
- // // base will append schema, table and alias
- // }
-
- private Expression OverrideVisitTable(TableExpression tableExpression)
- {
- var shardingAccessor = ShardingContainer.Services.GetService();
- if (shardingAccessor?.ShardingContext != null)
- {
- var virtualTableManager = ShardingContainer.Services.GetService();
- var virtualTable = virtualTableManager.GetAllVirtualTables().FirstOrDefault(o => o.GetOriginalTableName() == tableExpression.Table);
- if(virtualTable!=null)
- {
- var tails = shardingAccessor.ShardingContext.GetContextQueryTails(virtualTable);
- var tailPrefix = virtualTable.ShardingConfig.TailPrefix;
- string newTableName = null;
- var sqlGenerationHelper = typeof(DefaultQuerySqlGenerator).GetTypeFieldValue(this, "_sqlGenerationHelper") as ISqlGenerationHelper;
-
- if (tails.IsEmpty())
- {
- var firstTail = virtualTableManager.GetVirtualTable(tableExpression.Table).GetAllPhysicTables()[0].Tail;
- newTableName = $"( select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Table}{tailPrefix}{firstTail}", tableExpression.Schema)} where 1=2 )";
- }
- else if (tails.Count == 1)
- {
- //对tableExpresion进行重写
- //typeof(TableExpression)
- // .GetFields( BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(o=>o.Name==$"<{nameof(tableExpression.Name)}>k__BackingField")
- // .SetValue(tableExpression,$"{tableExpression.Name}{tailPrefix}{entry.Tails[0]}");
- newTableName = sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Table}{tailPrefix}{tails[0]}", tableExpression.Schema);
- }
- else
- {
- newTableName = "(" + string.Join(" union all ", tails.Select(tail => $"select * from {sqlGenerationHelper.DelimitIdentifier($"{tableExpression.Table}{tailPrefix}{tail}", tableExpression.Schema)}")) + ")";
- }
-
- var relationalCommandBuilder = typeof(DefaultQuerySqlGenerator).GetTypeFieldValue(this, "_relationalCommandBuilder") as IRelationalCommandBuilder;
- relationalCommandBuilder.Append(newTableName).Append(this.AliasSeparator).Append(sqlGenerationHelper.DelimitIdentifier(tableExpression.Alias));
- return tableExpression;
- }
- }
-
- var result = base.VisitTable(tableExpression);
- return result;
- }
- }
-}
-#endif
\ No newline at end of file
diff --git a/src/ShardingCore.SqlServer/EFCores/ShardingSqlServerUpdateSqlGenerator.cs b/src/ShardingCore.SqlServer/EFCores/ShardingSqlServerUpdateSqlGenerator.cs
deleted file mode 100644
index 3f0e5e90..00000000
--- a/src/ShardingCore.SqlServer/EFCores/ShardingSqlServerUpdateSqlGenerator.cs
+++ /dev/null
@@ -1,211 +0,0 @@
-// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using Microsoft.EntityFrameworkCore;
-// using Microsoft.EntityFrameworkCore.Metadata;
-// using Microsoft.EntityFrameworkCore.SqlServer.Update.Internal;
-// using Microsoft.EntityFrameworkCore.Update;
-// using Microsoft.Extensions.DependencyInjection;
-// using ShardingCore.Core.VirtualRoutes.TableRoutes;
-// using ShardingCore.Core.VirtualTables;
-// using ShardingCore.Exceptions;
-//
-// namespace ShardingCore.SqlServer.EFCores
-// {
-// /*
-// * @Author: xjm
-// * @Description:
-// * @Date: Friday, 23 July 2021 23:17:19
-// * @Email: 326308290@qq.com
-// */
-// public class ShardingSqlServerUpdateSqlGenerator:SqlServerUpdateSqlGenerator
-// {
-// public ShardingSqlServerUpdateSqlGenerator(UpdateSqlGeneratorDependencies dependencies) : base(dependencies)
-// {
-// }
-//
-// public override ResultSetMapping AppendInsertOperation(StringBuilder commandStringBuilder, ModificationCommand command, int commandPosition)
-// {
-// // Check.NotNull(commandStringBuilder, nameof(commandStringBuilder));
-// // Check.NotNull(command, nameof(command));
-// var virtualTableManager = ShardingContainer.Services.GetService();
-//
-// var name = command.TableName;
-// var schema = command.Schema;
-//
-// var operations = command.ColumnModifications;
-// var tryGetVirtualTable = virtualTableManager.TryGetVirtualTable(name);
-// if (tryGetVirtualTable != null)
-// {
-// var shardingEntityConfig = tryGetVirtualTable.ShardingConfig;
-// var shardingCol = operations.FirstOrDefault(o=>o.Property.Name.Equals(shardingEntityConfig.ShardingField));
-// if (shardingCol == null)
-// throw new ShardingKeyRouteNotMatchException();
-// // shardingEntityConfig.ShardingField
-// var physicTables = tryGetVirtualTable.RouteTo(new TableRouteConfig(null,null,shardingCol.Value));
-// name = physicTables[0].FullName;
-// }
-//
-// var writeOperations = operations.Where(o => o.IsWrite).ToList();
-// var readOperations = operations.Where(o => o.IsRead).ToList();
-//
-// AppendInsertCommand(commandStringBuilder, name, schema, writeOperations);
-//
-// if (readOperations.Count > 0)
-// {
-// var keyOperations = operations.Where(o => o.IsKey).ToList();
-//
-// return AppendSelectAffectedCommand(commandStringBuilder, name, schema, readOperations, keyOperations, commandPosition);
-// }
-//
-// return ResultSetMapping.NoResultSet;
-// }
-//
-// public override ResultSetMapping AppendUpdateOperation(StringBuilder commandStringBuilder, ModificationCommand command, int commandPosition)
-// {
-// // Check.NotNull(commandStringBuilder, nameof(commandStringBuilder));
-// // Check.NotNull(command, nameof(command));
-//
-// var name = command.TableName;
-// var schema = command.Schema;
-// var operations = command.ColumnModifications;
-//
-// var virtualTableManager = ShardingContainer.Services.GetService();
-// var tryGetVirtualTable = virtualTableManager.TryGetVirtualTable(name);
-// if (tryGetVirtualTable != null)
-// {
-// var shardingEntityConfig = tryGetVirtualTable.ShardingConfig;
-// var shardingCol = operations.FirstOrDefault(o=>o.IsRead&&o.Property.Name.Equals(shardingEntityConfig.ShardingField));
-// if (shardingCol == null)
-// throw new ShardingKeyRouteNotMatchException();
-// // shardingEntityConfig.ShardingField
-// var physicTables = tryGetVirtualTable.RouteTo(new TableRouteConfig(null,null,shardingCol.Value));
-// name = physicTables[0].FullName;
-// }
-//
-//
-// var writeOperations = operations.Where(o => o.IsWrite).ToList();
-// var conditionOperations = operations.Where(o => o.IsCondition).ToList();
-// var readOperations = operations.Where(o => o.IsRead).ToList();
-//
-// AppendUpdateCommand(commandStringBuilder, name, schema, writeOperations, conditionOperations);
-//
-// if (readOperations.Count > 0)
-// {
-// var keyOperations = operations.Where(o => o.IsKey).ToList();
-//
-// return AppendSelectAffectedCommand(commandStringBuilder, name, schema, readOperations, keyOperations, commandPosition);
-// }
-//
-// return AppendSelectAffectedCountCommand(commandStringBuilder, name, schema, commandPosition);
-// }
-//
-// public override ResultSetMapping AppendDeleteOperation(StringBuilder commandStringBuilder, ModificationCommand command, int commandPosition)
-// {
-// // Check.NotNull(commandStringBuilder, nameof (commandStringBuilder));
-// // Check.NotNull(command, nameof (command));
-//
-// var name = command.TableName;
-// var schema = command.Schema;
-// var conditionOperations = command.ColumnModifications.Where(o => o.IsCondition).ToList();
-//
-// var virtualTableManager = ShardingContainer.Services.GetService();
-// var tryGetVirtualTable = virtualTableManager.TryGetVirtualTable(name);
-// if (tryGetVirtualTable != null)
-// {
-// var shardingEntityConfig = tryGetVirtualTable.ShardingConfig;
-// var shardingCol = command.ColumnModifications.FirstOrDefault(o=>o.IsRead&&o.Property.Name.Equals(shardingEntityConfig.ShardingField));
-// if (shardingCol == null)
-// throw new ShardingKeyRouteNotMatchException();
-// // shardingEntityConfig.ShardingField
-// var physicTables = tryGetVirtualTable.RouteTo(new TableRouteConfig(null,null,shardingCol.Value));
-// name = physicTables[0].FullName;
-// }
-// AppendDeleteCommand(commandStringBuilder, name, schema, conditionOperations);
-//
-// return AppendSelectAffectedCountCommand(commandStringBuilder, name, schema, commandPosition);
-// }
-//
-// public override ResultSetMapping AppendBulkInsertOperation(StringBuilder commandStringBuilder, IReadOnlyList modificationCommands, int commandPosition)
-// {
-//
-//
-// if (modificationCommands.Count == 1
-// && modificationCommands[0].ColumnModifications.All(
-// o =>
-// !o.IsKey
-// || !o.IsRead
-// || o.Property?.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn))
-// {
-// return AppendInsertOperation(commandStringBuilder, modificationCommands[0], commandPosition);
-// }
-//
-// var readOperations = modificationCommands[0].ColumnModifications.Where(o => o.IsRead).ToList();
-// var writeOperations = modificationCommands[0].ColumnModifications.Where(o => o.IsWrite).ToList();
-// var keyOperations = modificationCommands[0].ColumnModifications.Where(o => o.IsKey).ToList();
-//
-// var defaultValuesOnly = writeOperations.Count == 0;
-// var nonIdentityOperations = modificationCommands[0].ColumnModifications
-// .Where(o => o.Property?.GetValueGenerationStrategy() != SqlServerValueGenerationStrategy.IdentityColumn)
-// .ToList();
-//
-// if (defaultValuesOnly)
-// {
-// if (nonIdentityOperations.Count == 0
-// || readOperations.Count == 0)
-// {
-// foreach (var modification in modificationCommands)
-// {
-// AppendInsertOperation(commandStringBuilder, modification, commandPosition);
-// }
-//
-// return readOperations.Count == 0
-// ? ResultSetMapping.NoResultSet
-// : ResultSetMapping.LastInResultSet;
-// }
-//
-// if (nonIdentityOperations.Count > 1)
-// {
-// nonIdentityOperations.RemoveRange(1, nonIdentityOperations.Count - 1);
-// }
-// }
-//
-// if (readOperations.Count == 0)
-// {
-// return AppendBulkInsertWithoutServerValues(commandStringBuilder, modificationCommands, writeOperations);
-// }
-//
-// if (defaultValuesOnly)
-// {
-// return AppendBulkInsertWithServerValuesOnly(
-// commandStringBuilder, modificationCommands, commandPosition, nonIdentityOperations, keyOperations, readOperations);
-// }
-//
-// if (modificationCommands[0].Entries.SelectMany(e => e.EntityType.GetAllBaseTypesInclusive())
-// .Any(e => e.IsMemoryOptimized()))
-// {
-// if (!nonIdentityOperations.Any(o => o.IsRead && o.IsKey))
-// {
-// foreach (var modification in modificationCommands)
-// {
-// AppendInsertOperation(commandStringBuilder, modification, commandPosition++);
-// }
-// }
-// else
-// {
-// foreach (var modification in modificationCommands)
-// {
-// AppendInsertOperationWithServerKeys(
-// commandStringBuilder, modification, keyOperations, readOperations, commandPosition++);
-// }
-// }
-//
-// return ResultSetMapping.LastInResultSet;
-// }
-//
-// return AppendBulkInsertWithServerValues(
-// commandStringBuilder, modificationCommands, commandPosition, writeOperations, keyOperations, readOperations);
-// }
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore.SqlServer/ShardingCore.SqlServer.csproj b/src/ShardingCore.SqlServer/ShardingCore.SqlServer.csproj
deleted file mode 100644
index c4a2388c..00000000
--- a/src/ShardingCore.SqlServer/ShardingCore.SqlServer.csproj
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- netstandard2.1
- $(EFCORE5)
- true
- TRACE;DEBUG;EFCORE5;
- 8.0
-
-
-
- true
- bin\Release\ShardingCore.SqlServer.xml
-
-
-
-
-
-
-
-
-
-
-
-
- C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\5.0.0\ref\net5.0\Microsoft.Extensions.Logging.Console.dll
-
-
-
-
diff --git a/src/ShardingCore.SqlServer/ShardingSqlServerParallelDbContextFactory.cs b/src/ShardingCore.SqlServer/ShardingSqlServerParallelDbContextFactory.cs
deleted file mode 100644
index a434df94..00000000
--- a/src/ShardingCore.SqlServer/ShardingSqlServerParallelDbContextFactory.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Query.Internal;
-using ShardingCore.Core.VirtualTables;
-using ShardingCore.DbContexts;
-using ShardingCore.DbContexts.ShardingDbContexts;
-using ShardingCore.EFCores;
-using ShardingCore.Extensions;
-
-namespace ShardingCore.SqlServer
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: Tuesday, 29 December 2020 15:22:50
-* @Email: 326308290@qq.com
-*/
- public class ShardingSqlServerParallelDbContextFactory : IShardingParallelDbContextFactory
- {
- private readonly IVirtualTableManager _virtualTableManager;
- private readonly IShardingDbContextFactory _shardingDbContextFactory;
- private readonly IShardingCoreOptions _shardingCoreOptions;
-
- public ShardingSqlServerParallelDbContextFactory(IVirtualTableManager virtualTableManager,IShardingCoreOptions shardingCoreOptions, IShardingDbContextFactory shardingDbContextFactory)
- {
- _virtualTableManager = virtualTableManager;
- _shardingDbContextFactory = shardingDbContextFactory;
- _shardingCoreOptions = shardingCoreOptions;
- }
-
- public DbContext Create(string tail)
- {
- var shardingConfigEntry = _shardingCoreOptions.GetShardingConfig();
- var shardingDbContextOptions = new ShardingDbContextOptions(CreateOptions(shardingConfigEntry.ConnectionString), tail);
- return _shardingDbContextFactory.Create(shardingDbContextOptions);
- }
-
- private DbContextOptions CreateOptions(string connectString)
- {
- return CreateDbContextOptionBuilder()
- .UseSqlServer(connectString)
- .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking)
- .ReplaceService()
- .ReplaceService()
- .ReplaceService()
- .UseShardingSqlServerQuerySqlGenerator()
- .Options;
- }
- private DbContextOptionsBuilder CreateDbContextOptionBuilder()
- {
- var shardingConfigEntry = _shardingCoreOptions.GetShardingConfig();
- Type type = typeof(DbContextOptionsBuilder<>);
- type = type.MakeGenericType(shardingConfigEntry.DbContextType);
- return (DbContextOptionsBuilder)Activator.CreateInstance(type);
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.SqlServer/SqlServerDbContextOptionsProvider.cs b/src/ShardingCore.SqlServer/SqlServerDbContextOptionsProvider.cs
deleted file mode 100644
index 4173a6b6..00000000
--- a/src/ShardingCore.SqlServer/SqlServerDbContextOptionsProvider.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data.Common;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Query.Internal;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Logging.Console;
-using ShardingCore.DbContexts.VirtualDbContexts;
-using ShardingCore.DbContexts.VirtualDbContexts.ShareDbContextOptionsProviders;
-using ShardingCore.EFCores;
-using ShardingCore.Extensions;
-#if EFCORE2
-using System.Data.SqlClient;
-#endif
-#if !EFCORE2
-using Microsoft.Data.SqlClient;
-#endif
-
-namespace ShardingCore.SqlServer
-{
- /*
- * @Author: xjm
- * @Description:
- * @Date: Thursday, 24 December 2020 10:33:51
- * @Email: 326308290@qq.com
- */
- public class SqlServerDbContextOptionsProvider : IDbContextOptionsProvider
- {
- private readonly IShardingCoreOptions _shardingCoreOptions;
- public static readonly ILoggerFactory efLogger = LoggerFactory.Create(builder =>
- {
- builder.AddFilter((category, level) => category == DbLoggerCategory.Database.Command.Name && level == LogLevel.Information).AddConsole();
- });
-
-
- public SqlServerDbContextOptionsProvider(IShardingCoreOptions shardingCoreOptions)
- {
- _shardingCoreOptions = shardingCoreOptions;
- }
- public DbContextOptions GetDbContextOptions(DbConnection dbConnection)
- {
-
- var track = dbConnection != null;
- var connection = dbConnection ?? GetSqlConnection();
- var dbContextOptions = CreateDbContextOptionBuilder()
- .UseSqlServer(connection)
- .UseLoggerFactory(efLogger)
- .IfDo(!track, o => o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking))
- //.IfDo(isQuery,o=>o.ReplaceService())
- .ReplaceService()
- .ReplaceService()
- //.IfDo(isQuery,o=>o.UseShardingSqlServerQuerySqlGenerator())
- .Options;
- return dbContextOptions;
- }
- private SqlConnection GetSqlConnection()
- {
- var connectionString = _shardingCoreOptions.GetShardingConfig().ConnectionString;
- return new SqlConnection(connectionString);
- }
-
-
- private DbContextOptionsBuilder CreateDbContextOptionBuilder()
- {
- var shardingConfigEntry = _shardingCoreOptions.GetShardingConfig();
- Type type = typeof(DbContextOptionsBuilder<>);
- type = type.MakeGenericType(shardingConfigEntry.DbContextType);
- return (DbContextOptionsBuilder)Activator.CreateInstance(type);
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore.SqlServer/SqlServerOptions.cs b/src/ShardingCore.SqlServer/SqlServerOptions.cs
deleted file mode 100644
index 92f17826..00000000
--- a/src/ShardingCore.SqlServer/SqlServerOptions.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace ShardingCore.SqlServer
-{
-/*
-* @Author: xjm
-* @Description:
-* @Date: 2020年4月7日 8:34:04
-* @Email: 326308290@qq.com
-*/
- public class SqlServerOptions: AbstractShardingCoreOptions
- {
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore/EFCores/ShardingQueryCompiler.cs b/src/ShardingCore/EFCores/ShardingQueryCompiler.cs
index 1c41b1ef..6ac7b0cc 100644
--- a/src/ShardingCore/EFCores/ShardingQueryCompiler.cs
+++ b/src/ShardingCore/EFCores/ShardingQueryCompiler.cs
@@ -1,14 +1,9 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Diagnostics;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Internal;
-using Microsoft.EntityFrameworkCore.Storage;
using ShardingCore.Exceptions;
using ShardingCore.Extensions;
using ShardingCore.Sharding.Abstractions;
-using ShardingCore.Sharding.Enumerators;
using ShardingCore.Sharding.StreamMergeEngines;
using ShardingCore.Sharding.StreamMergeEngines.Abstractions;
using ShardingCore.Sharding.StreamMergeEngines.AggregateMergeEngines;
@@ -29,20 +24,12 @@ namespace ShardingCore.EFCores
**/
public class ShardingQueryCompiler : IQueryCompiler
{
- private readonly IQueryContextFactory _queryContextFactory;
- private readonly IDatabase _database;
- private readonly IDiagnosticsLogger _logger;
private readonly ICurrentDbContext _currentContext;
- private readonly IModel _model;
private readonly IStreamMergeContextFactory _streamMergeContextFactory;
- public ShardingQueryCompiler(IQueryContextFactory queryContextFactory, ICompiledQueryCache compiledQueryCache, ICompiledQueryCacheKeyGenerator compiledQueryCacheKeyGenerator, IDatabase database, IDiagnosticsLogger logger, ICurrentDbContext currentContext, IEvaluatableExpressionFilter evaluatableExpressionFilter, IModel model)
+ public ShardingQueryCompiler(ICurrentDbContext currentContext)
{
- _queryContextFactory = queryContextFactory;
- _database = database;
- _logger = logger;
_currentContext = currentContext;
- _model = model;
_streamMergeContextFactory = ShardingContainer.GetService();
}
diff --git a/src2x/ShardingCore.MySql.2x/ShardingCore.MySql.2x.csproj b/src2x/ShardingCore.MySql.2x/ShardingCore.MySql.2x.csproj
deleted file mode 100644
index 84b30a13..00000000
--- a/src2x/ShardingCore.MySql.2x/ShardingCore.MySql.2x.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- netstandard2.0
- $(EFCORE2)
- true
- TRACE;DEBUG;EFCORE2;
- 8.0
- ShardingCore.MySql
- ShardingCore.MySql
-
-
-
- true
- bin\Release\ShardingCore.MySql.2x.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src2x/ShardingCore.SqlServer.2x/ShardingCore.SqlServer.2x.csproj b/src2x/ShardingCore.SqlServer.2x/ShardingCore.SqlServer.2x.csproj
deleted file mode 100644
index 42f4122f..00000000
--- a/src2x/ShardingCore.SqlServer.2x/ShardingCore.SqlServer.2x.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- netstandard2.0
- $(EFCORE2)
- true
- TRACE;DEBUG;EFCORE2;
- 8.0
- ShardingCore.SqlServer
- ShardingCore.SqlServer
-
-
-
- true
- bin\Release\ShardingCore.SqlServer.2x.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src3x/ShardingCore.MySql.3x/ShardingCore.MySql.3x.csproj b/src3x/ShardingCore.MySql.3x/ShardingCore.MySql.3x.csproj
deleted file mode 100644
index ff1a4f3a..00000000
--- a/src3x/ShardingCore.MySql.3x/ShardingCore.MySql.3x.csproj
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- netstandard2.0
- $(EFCORE3)
- true
- TRACE;DEBUG;EFCORE3;
- 8.0
- ShardingCore.MySql
- ShardingCore.MySql
-
-
-
- true
- bin\Release\ShardingCore.MySql.3x.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src3x/ShardingCore.SqlServer.3x/ShardingCore.SqlServer.3x.csproj b/src3x/ShardingCore.SqlServer.3x/ShardingCore.SqlServer.3x.csproj
deleted file mode 100644
index 645d3bb8..00000000
--- a/src3x/ShardingCore.SqlServer.3x/ShardingCore.SqlServer.3x.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- netstandard2.0
- $(EFCORE3)
- true
- TRACE;DEBUG;EFCORE3;
- 8.0
- ShardingCore.SqlServer
- ShardingCore.SqlServer
-
-
-
- true
- bin\Release\ShardingCore.SqlServer.3x.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/ShardingCore.Test50/ShardingCore.Test50.csproj b/test/ShardingCore.Test50/ShardingCore.Test50.csproj
index 1d54417d..b4de1a90 100644
--- a/test/ShardingCore.Test50/ShardingCore.Test50.csproj
+++ b/test/ShardingCore.Test50/ShardingCore.Test50.csproj
@@ -15,10 +15,6 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
true