commit
0addfdd6ab
|
@ -73,7 +73,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore3", "src3\Shard
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore2", "src2\ShardingCore2\ShardingCore2.csproj", "{F0393C32-2285-4F47-AC61-C1BA1CAC269D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore2", "src2\ShardingCore2\ShardingCore2.csproj", "{F0393C32-2285-4F47-AC61-C1BA1CAC269D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.MySQLDataSourceOnly", "samples\Sample.MySQLDataSourceOnly\Sample.MySQLDataSourceOnly.csproj", "{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.MySQLDataSourceOnly", "samples\Sample.MySQLDataSourceOnly\Sample.MySQLDataSourceOnly.csproj", "{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore7", "src7\ShardingCore7\ShardingCore7.csproj", "{A308D253-A072-40EC-AA97-15EE82BB8AAD}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src7", "src7", "{A5321A3E-8539-4E2A-889C-8E91989EECBD}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -193,6 +197,10 @@ Global
|
||||||
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}.Release|Any CPU.Build.0 = Release|Any CPU
|
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A308D253-A072-40EC-AA97-15EE82BB8AAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A308D253-A072-40EC-AA97-15EE82BB8AAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A308D253-A072-40EC-AA97-15EE82BB8AAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A308D253-A072-40EC-AA97-15EE82BB8AAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -226,6 +234,7 @@ Global
|
||||||
{B59909AD-8885-40F3-9454-6C8433463BCC} = {51E1D067-3E81-4815-94F2-F8ABBE80881E}
|
{B59909AD-8885-40F3-9454-6C8433463BCC} = {51E1D067-3E81-4815-94F2-F8ABBE80881E}
|
||||||
{F0393C32-2285-4F47-AC61-C1BA1CAC269D} = {B11D7DF7-A907-407E-8BF1-35B430413557}
|
{F0393C32-2285-4F47-AC61-C1BA1CAC269D} = {B11D7DF7-A907-407E-8BF1-35B430413557}
|
||||||
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
|
{3B5A4B03-5190-41A8-8E4B-F95A79A5C018} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
|
||||||
|
{A308D253-A072-40EC-AA97-15EE82BB8AAD} = {A5321A3E-8539-4E2A-889C-8E91989EECBD}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {8C07A667-E8B4-43C7-8053-721584BAD291}
|
SolutionGuid = {8C07A667-E8B4-43C7-8053-721584BAD291}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using ShardingCore.Core.RuntimeContexts;
|
using ShardingCore.Core.RuntimeContexts;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -32,10 +32,10 @@ namespace ShardingCore.Extensions
|
||||||
/// <param name="dbContext"></param>
|
/// <param name="dbContext"></param>
|
||||||
public static void RemoveDbContextRelationModelThatIsShardingTable(this DbContext dbContext)
|
public static void RemoveDbContextRelationModelThatIsShardingTable(this DbContext dbContext)
|
||||||
{
|
{
|
||||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6 && !EFCORE7
|
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6 && !EFCORE7 && !EFCORE8
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE6 ||EFCORE7
|
#if EFCORE6 ||EFCORE7 || EFCORE8
|
||||||
|
|
||||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model;
|
var contextModel = dbContext.GetService<IDesignTimeModel>().Model;
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,7 +46,7 @@ namespace ShardingCore.Extensions
|
||||||
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
||||||
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
||||||
|
|
||||||
#if EFCORE6 || EFCORE7
|
#if EFCORE6 || EFCORE7 || EFCORE8
|
||||||
var entityTypes = contextModel.GetEntityTypes();
|
var entityTypes = contextModel.GetEntityTypes();
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
{
|
{
|
||||||
|
@ -56,13 +56,22 @@ namespace ShardingCore.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||||
|
#if EFCORE6 || EFCORE7
|
||||||
|
|
||||||
var valueTuples =
|
var valueTuples =
|
||||||
contextModelRelationalModel.Tables.Where(o =>o.Value.EntityTypeMappings.Any(m => entityMetadataManager.IsShardingTable(m.EntityType.ClrType))).Select(o => o.Key).ToList();
|
contextModelRelationalModel.Tables.Where(o =>o.Value.EntityTypeMappings.Any(m => entityMetadataManager.IsShardingTable(m.EntityType.ClrType))).Select(o => o.Key).ToList();
|
||||||
|
#endif
|
||||||
|
#if EFCORE8
|
||||||
|
var valueTuples =
|
||||||
|
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => entityMetadataManager.IsShardingTable(m.TypeBase.ClrType))).Select(o => o.Key).ToList();
|
||||||
|
#endif
|
||||||
for (int i = 0; i < valueTuples.Count; i++)
|
for (int i = 0; i < valueTuples.Count; i++)
|
||||||
{
|
{
|
||||||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if EFCORE5
|
#if EFCORE5
|
||||||
var entityTypes = contextModel.GetEntityTypes();
|
var entityTypes = contextModel.GetEntityTypes();
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
|
@ -132,10 +141,10 @@ namespace ShardingCore.Extensions
|
||||||
/// <param name="dbContext"></param>
|
/// <param name="dbContext"></param>
|
||||||
public static void RemoveDbContextAllRelationModelWithoutShardingDataSourceOnly(this DbContext dbContext)
|
public static void RemoveDbContextAllRelationModelWithoutShardingDataSourceOnly(this DbContext dbContext)
|
||||||
{
|
{
|
||||||
#if !EFCORE2&& !EFCORE3 && !EFCORE5 && !EFCORE6 && !EFCORE7
|
#if !EFCORE2&& !EFCORE3 && !EFCORE5 && !EFCORE6 && !EFCORE7 && !EFCORE8
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE6 || EFCORE7
|
#if EFCORE6 || EFCORE7 || EFCORE8
|
||||||
|
|
||||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||||
#endif
|
#endif
|
||||||
|
@ -146,7 +155,7 @@ namespace ShardingCore.Extensions
|
||||||
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
||||||
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
||||||
|
|
||||||
#if EFCORE6 || EFCORE7
|
#if EFCORE6 || EFCORE7 || EFCORE8
|
||||||
var entityTypes = contextModel.GetEntityTypes();
|
var entityTypes = contextModel.GetEntityTypes();
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
{
|
{
|
||||||
|
@ -156,13 +165,22 @@ namespace ShardingCore.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||||
|
#if EFCORE6 || EFCORE7
|
||||||
var valueTuples =
|
var valueTuples =
|
||||||
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.EntityType.ClrType)) ).Select(o => o.Key).ToList();
|
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.EntityType.ClrType)) ).Select(o => o.Key).ToList();
|
||||||
|
#endif
|
||||||
|
#if EFCORE8
|
||||||
|
var valueTuples =
|
||||||
|
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.TypeBase.ClrType))).Select(o => o.Key).ToList();
|
||||||
|
#endif
|
||||||
for (int i = 0; i < valueTuples.Count; i++)
|
for (int i = 0; i < valueTuples.Count; i++)
|
||||||
{
|
{
|
||||||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if EFCORE5
|
#if EFCORE5
|
||||||
var entityTypes = contextModel.GetEntityTypes();
|
var entityTypes = contextModel.GetEntityTypes();
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
|
@ -204,10 +222,10 @@ namespace ShardingCore.Extensions
|
||||||
/// <param name="dbContext"></param>
|
/// <param name="dbContext"></param>
|
||||||
public static void RemoveDbContextAllRelationModel(this DbContext dbContext)
|
public static void RemoveDbContextAllRelationModel(this DbContext dbContext)
|
||||||
{
|
{
|
||||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6&& !EFCORE7
|
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6&& !EFCORE7&& !EFCORE8
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE6|| EFCORE7
|
#if EFCORE6|| EFCORE7 || EFCORE8
|
||||||
|
|
||||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||||
#endif
|
#endif
|
||||||
|
@ -216,7 +234,7 @@ namespace ShardingCore.Extensions
|
||||||
var contextModel = dbContext.Model as Model;
|
var contextModel = dbContext.Model as Model;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFCORE6 || EFCORE7
|
#if EFCORE6 || EFCORE7 || EFCORE8
|
||||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||||
contextModelRelationalModel.Tables.Clear();
|
contextModelRelationalModel.Tables.Clear();
|
||||||
#endif
|
#endif
|
||||||
|
@ -239,14 +257,14 @@ namespace ShardingCore.Extensions
|
||||||
public static void RemoveDbContextRelationModelSaveOnlyThatIsNamedType(this DbContext dbContext,
|
public static void RemoveDbContextRelationModelSaveOnlyThatIsNamedType(this DbContext dbContext,
|
||||||
Type shardingType)
|
Type shardingType)
|
||||||
{
|
{
|
||||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6&& !EFCORE7
|
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6&& !EFCORE7&& !EFCORE8
|
||||||
1
|
1
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE2 || EFCORE3 || EFCORE5
|
#if EFCORE2 || EFCORE3 || EFCORE5
|
||||||
|
|
||||||
var contextModel = dbContext.Model as Model;
|
var contextModel = dbContext.Model as Model;
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE6 || EFCORE7
|
#if EFCORE6 || EFCORE7 || EFCORE8
|
||||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model;
|
var contextModel = dbContext.GetService<IDesignTimeModel>().Model;
|
||||||
var entityTypes = contextModel.GetEntityTypes();
|
var entityTypes = contextModel.GetEntityTypes();
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
|
@ -257,16 +275,26 @@ namespace ShardingCore.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||||
|
#if EFCORE6 || EFCORE7
|
||||||
var valueTuples =
|
var valueTuples =
|
||||||
contextModelRelationalModel.Tables
|
contextModelRelationalModel.Tables
|
||||||
.Where(o => o.Value.EntityTypeMappings.All(m => m.EntityType.ClrType != shardingType))
|
.Where(o => o.Value.EntityTypeMappings.All(m => m.EntityType.ClrType != shardingType))
|
||||||
.Select(o => o.Key).ToList();
|
.Select(o => o.Key).ToList();
|
||||||
|
#endif
|
||||||
|
#if EFCORE8
|
||||||
|
var valueTuples =
|
||||||
|
contextModelRelationalModel.Tables
|
||||||
|
.Where(o => o.Value.EntityTypeMappings.All(m => m.TypeBase.ClrType != shardingType))
|
||||||
|
.Select(o => o.Key).ToList();
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < valueTuples.Count; i++)
|
for (int i = 0; i < valueTuples.Count; i++)
|
||||||
{
|
{
|
||||||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if EFCORE5
|
#if EFCORE5
|
||||||
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7|| EFCORE8
|
||||||
using ShardingCore.Sharding.MergeEngines.Executors.Abstractions;
|
using ShardingCore.Sharding.MergeEngines.Executors.Abstractions;
|
||||||
using ShardingCore.Sharding.MergeEngines.Executors.Methods;
|
using ShardingCore.Sharding.MergeEngines.Executors.Methods;
|
||||||
using ShardingCore.Sharding.MergeEngines.ShardingMergeEngines.Abstractions.InMemoryMerge;
|
using ShardingCore.Sharding.MergeEngines.ShardingMergeEngines.Abstractions.InMemoryMerge;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
using ShardingCore.Sharding.MergeEngines.Executors.Abstractions;
|
using ShardingCore.Sharding.MergeEngines.Executors.Abstractions;
|
||||||
using ShardingCore.Sharding.MergeEngines.Executors.Methods;
|
using ShardingCore.Sharding.MergeEngines.Executors.Methods;
|
||||||
using ShardingCore.Sharding.MergeEngines.ShardingMergeEngines.Abstractions.InMemoryMerge;
|
using ShardingCore.Sharding.MergeEngines.ShardingMergeEngines.Abstractions.InMemoryMerge;
|
||||||
|
|
|
@ -67,12 +67,12 @@ namespace ShardingCore.Sharding.Parsers.Visitors
|
||||||
return base.VisitConstant(node);
|
return base.VisitConstant(node);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE5 || EFCORE6 || EFCORE7
|
#if EFCORE5 || EFCORE6 || EFCORE7 || EFCORE8
|
||||||
protected override Expression VisitExtension(Expression node)
|
protected override Expression VisitExtension(Expression node)
|
||||||
{
|
{
|
||||||
if (node is QueryRootExpression queryRootExpression)
|
if (node is QueryRootExpression queryRootExpression)
|
||||||
{
|
{
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
TryAddShardingEntities(queryRootExpression.ElementType, null);
|
TryAddShardingEntities(queryRootExpression.ElementType, null);
|
||||||
#else
|
#else
|
||||||
TryAddShardingEntities(queryRootExpression.EntityType.ClrType, null);
|
TryAddShardingEntities(queryRootExpression.EntityType.ClrType, null);
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace ShardingCore.Sharding.ShardingQueryExecutors
|
||||||
return EnsureResultTypeMergeExecute<TResult>(typeof(ContainsAsyncInMemoryMergeEngine<>),
|
return EnsureResultTypeMergeExecute<TResult>(typeof(ContainsAsyncInMemoryMergeEngine<>),
|
||||||
mergeQueryCompilerContext, async, cancellationToken);
|
mergeQueryCompilerContext, async, cancellationToken);
|
||||||
|
|
||||||
#if EFCORE7
|
#if EFCORE7|| EFCORE8
|
||||||
case nameof(RelationalQueryableExtensions.ExecuteUpdate):
|
case nameof(RelationalQueryableExtensions.ExecuteUpdate):
|
||||||
return EnsureResultTypeMergeExecute<TResult>(typeof(ExecuteUpdateAsyncMemoryMergeEngine<>),
|
return EnsureResultTypeMergeExecute<TResult>(typeof(ExecuteUpdateAsyncMemoryMergeEngine<>),
|
||||||
mergeQueryCompilerContext, async, cancellationToken);
|
mergeQueryCompilerContext, async, cancellationToken);
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace ShardingCore.Sharding.ShardingExecutors
|
||||||
case nameof(Queryable.LongCount):
|
case nameof(Queryable.LongCount):
|
||||||
case nameof(Queryable.Any):
|
case nameof(Queryable.Any):
|
||||||
return _whereQueryableCombine;
|
return _whereQueryableCombine;
|
||||||
#if EFCORE7
|
#if EFCORE7|| EFCORE8
|
||||||
case nameof(RelationalQueryableExtensions.ExecuteUpdate):
|
case nameof(RelationalQueryableExtensions.ExecuteUpdate):
|
||||||
return _executeUpdateQueryableCombine;
|
return _executeUpdateQueryableCombine;
|
||||||
case nameof(RelationalQueryableExtensions.ExecuteDelete):
|
case nameof(RelationalQueryableExtensions.ExecuteDelete):
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace ShardingCore.Core.Internal.Visitors
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFCORE5 || EFCORE6 ||EFCORE7
|
#if EFCORE5 || EFCORE6 ||EFCORE7 ||EFCORE8
|
||||||
internal class DbContextReplaceQueryableVisitor : DbContextInnerMemberReferenceReplaceQueryableVisitor
|
internal class DbContextReplaceQueryableVisitor : DbContextInnerMemberReferenceReplaceQueryableVisitor
|
||||||
{
|
{
|
||||||
private readonly DbContext _dbContext;
|
private readonly DbContext _dbContext;
|
||||||
|
@ -191,12 +191,12 @@ namespace ShardingCore.Core.Internal.Visitors
|
||||||
var dbContextDependencies =
|
var dbContextDependencies =
|
||||||
typeof(DbContext).GetTypePropertyValue(_dbContext, "DbContextDependencies") as
|
typeof(DbContext).GetTypePropertyValue(_dbContext, "DbContextDependencies") as
|
||||||
IDbContextDependencies;
|
IDbContextDependencies;
|
||||||
#if !EFCORE7
|
#if !EFCORE7&& !EFCORE8
|
||||||
var targetIQ =
|
var targetIQ =
|
||||||
(IQueryable)((IDbSetCache)_dbContext).GetOrAddSet(dbContextDependencies.SetSource,
|
(IQueryable)((IDbSetCache)_dbContext).GetOrAddSet(dbContextDependencies.SetSource,
|
||||||
queryRootExpression.EntityType.ClrType);
|
queryRootExpression.EntityType.ClrType);
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE7
|
#if EFCORE7|| EFCORE8
|
||||||
|
|
||||||
var targetIQ =
|
var targetIQ =
|
||||||
(IQueryable)((IDbSetCache)_dbContext).GetOrAddSet(dbContextDependencies.SetSource,
|
(IQueryable)((IDbSetCache)_dbContext).GetOrAddSet(dbContextDependencies.SetSource,
|
||||||
|
@ -209,12 +209,12 @@ namespace ShardingCore.Core.Internal.Visitors
|
||||||
RootIsVisit = true;
|
RootIsVisit = true;
|
||||||
if (queryRootExpression is FromSqlQueryRootExpression fromSqlQueryRootExpression)
|
if (queryRootExpression is FromSqlQueryRootExpression fromSqlQueryRootExpression)
|
||||||
{
|
{
|
||||||
#if !EFCORE7
|
#if !EFCORE7 && !EFCORE8
|
||||||
var sqlQueryRootExpression = new FromSqlQueryRootExpression(newQueryable.Provider as IAsyncQueryProvider,
|
var sqlQueryRootExpression = new FromSqlQueryRootExpression(newQueryable.Provider as IAsyncQueryProvider,
|
||||||
queryRootExpression.EntityType, fromSqlQueryRootExpression.Sql,
|
queryRootExpression.EntityType, fromSqlQueryRootExpression.Sql,
|
||||||
fromSqlQueryRootExpression.Argument);
|
fromSqlQueryRootExpression.Argument);
|
||||||
#endif
|
#endif
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
var sqlQueryRootExpression = new FromSqlQueryRootExpression(newQueryable.Provider as IAsyncQueryProvider,
|
var sqlQueryRootExpression = new FromSqlQueryRootExpression(newQueryable.Provider as IAsyncQueryProvider,
|
||||||
fromSqlQueryRootExpression.EntityType, fromSqlQueryRootExpression.Sql,
|
fromSqlQueryRootExpression.EntityType, fromSqlQueryRootExpression.Sql,
|
||||||
fromSqlQueryRootExpression.Argument);
|
fromSqlQueryRootExpression.Argument);
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace ShardingCore.Core.Internal.Visitors.Querys
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFCORE5|| EFCORE6 || EFCORE7
|
#if EFCORE5|| EFCORE6 || EFCORE7 || EFCORE8
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取分表类型
|
/// 获取分表类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -137,7 +137,7 @@ namespace ShardingCore.Core.Internal.Visitors.Querys
|
||||||
{
|
{
|
||||||
if (node is QueryRootExpression queryRootExpression)
|
if (node is QueryRootExpression queryRootExpression)
|
||||||
{
|
{
|
||||||
#if EFCORE7
|
#if EFCORE7 || EFCORE8
|
||||||
_shardingEntities.Add(queryRootExpression.ElementType);
|
_shardingEntities.Add(queryRootExpression.ElementType);
|
||||||
#else
|
#else
|
||||||
_shardingEntities.Add(queryRootExpression.EntityType.ClrType);
|
_shardingEntities.Add(queryRootExpression.EntityType.ClrType);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Version>$(EFCORE7)</Version>
|
<Version>$(EFCORE8)</Version>
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
<DefineConstants>TRACE;DEBUG;EFCORE7;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EFCORE8;</DefineConstants>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<RepositoryUrl>https://github.com/dotnetcore/sharding-core</RepositoryUrl>
|
<RepositoryUrl>https://github.com/dotnetcore/sharding-core</RepositoryUrl>
|
||||||
<PackageIcon>logo.png</PackageIcon>
|
<PackageIcon>logo.png</PackageIcon>
|
||||||
|
@ -34,8 +34,8 @@
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Sharding\Visitors\GroupBys" />
|
<Folder Include="Sharding\Visitors\GroupBys" />
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Version>$(EFCORE7)</Version>
|
||||||
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
|
<DefineConstants>TRACE;DEBUG;EFCORE7;</DefineConstants>
|
||||||
|
<LangVersion>9.0</LangVersion>
|
||||||
|
<AssemblyName>ShardingCore</AssemblyName>
|
||||||
|
<RootNamespace>ShardingCore</RootNamespace>
|
||||||
|
<RepositoryUrl>https://github.com/xuejmnet/sharding-core</RepositoryUrl>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
|
<DocumentationFile>bin\Release\ShardingCore7.xml</DocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\Logo\logo.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath>\</PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\src\ShardingCore\**\*.cs" />
|
||||||
|
<Compile Remove="..\..\src\ShardingCore\obj\**" />
|
||||||
|
<Compile Remove="..\..\src\ShardingCore\bin\**" />
|
||||||
|
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue