新增efcore6的额外lib添加了许多非efcore对应版本的编译错误提示
This commit is contained in:
parent
a4f70cea61
commit
7326656ff4
|
@ -67,6 +67,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore.CommonTest", "
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.ShardingConsole", "samples\Sample.ShardingConsole\Sample.ShardingConsole.csproj", "{BAB101D4-2BFF-44CE-90E3-8B72DDB266B8}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src6x", "src6x", "{BB80F31B-37F1-44C2-BCFA-F45D1AC765FE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore.6x", "src6x\ShardingCore.6x\ShardingCore.6x.csproj", "{1FF83CC3-A5F2-45E0-AA39-23C4DDF87D71}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -173,6 +177,10 @@ Global
|
|||
{BAB101D4-2BFF-44CE-90E3-8B72DDB266B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BAB101D4-2BFF-44CE-90E3-8B72DDB266B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BAB101D4-2BFF-44CE-90E3-8B72DDB266B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1FF83CC3-A5F2-45E0-AA39-23C4DDF87D71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1FF83CC3-A5F2-45E0-AA39-23C4DDF87D71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1FF83CC3-A5F2-45E0-AA39-23C4DDF87D71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1FF83CC3-A5F2-45E0-AA39-23C4DDF87D71}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -203,6 +211,7 @@ Global
|
|||
{40C83D48-0614-4651-98C6-2ABBE857D83D} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
|
||||
{3E895438-E609-4860-8391-6897ED55DA06} = {CC2C88C0-65F2-445D-BE78-973B840FE281}
|
||||
{BAB101D4-2BFF-44CE-90E3-8B72DDB266B8} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
|
||||
{1FF83CC3-A5F2-45E0-AA39-23C4DDF87D71} = {BB80F31B-37F1-44C2-BCFA-F45D1AC765FE}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8C07A667-E8B4-43C7-8053-721584BAD291}
|
||||
|
|
|
@ -19,8 +19,9 @@ namespace ShardingCore.EFCores.ChangeTrackers
|
|||
{
|
||||
_dbContext = context;
|
||||
}
|
||||
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
1
|
||||
error
|
||||
#endif
|
||||
|
||||
public override bool HasChanges()
|
||||
|
|
|
@ -7,8 +7,6 @@ using ShardingCore.Core.RuntimeContexts;
|
|||
|
||||
namespace ShardingCore.EFCores.OptionsExtensions
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
* @Author: xjm
|
||||
* @Description:
|
||||
|
@ -16,6 +14,9 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
* @Ver: 1.0
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
|
||||
#if EFCORE6
|
||||
public class ShardingOptionsExtension : IDbContextOptionsExtension
|
||||
|
@ -26,9 +27,10 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
{
|
||||
ShardingRuntimeContext = shardingRuntimeContext;
|
||||
}
|
||||
|
||||
public void ApplyServices(IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IShardingRuntimeContext>(sp =>ShardingRuntimeContext);
|
||||
services.AddSingleton<IShardingRuntimeContext>(sp => ShardingRuntimeContext);
|
||||
}
|
||||
|
||||
public void Validate(IDbContextOptions options)
|
||||
|
@ -41,12 +43,14 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
private class ShardingOptionsExtensionInfo : DbContextOptionsExtensionInfo
|
||||
{
|
||||
private readonly ShardingOptionsExtension _shardingOptionsExtension;
|
||||
|
||||
public ShardingOptionsExtensionInfo(IDbContextOptionsExtension extension) : base(extension)
|
||||
{
|
||||
_shardingOptionsExtension = (ShardingOptionsExtension)extension;
|
||||
}
|
||||
|
||||
public override int GetServiceProviderHashCode() => _shardingOptionsExtension.ShardingRuntimeContext.GetHashCode();
|
||||
public override int GetServiceProviderHashCode() =>
|
||||
_shardingOptionsExtension.ShardingRuntimeContext.GetHashCode();
|
||||
|
||||
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) => true;
|
||||
|
||||
|
@ -60,7 +64,6 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
}
|
||||
#endif
|
||||
#if EFCORE3 || EFCORE5
|
||||
|
||||
public class ShardingOptionsExtension: IDbContextOptionsExtension
|
||||
{
|
||||
public IShardingRuntimeContext ShardingRuntimeContext { get; }
|
||||
|
@ -101,7 +104,6 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
|
||||
#endif
|
||||
#if EFCORE2
|
||||
|
||||
public class ShardingOptionsExtension: IDbContextOptionsExtension
|
||||
{
|
||||
public IShardingRuntimeContext ShardingRuntimeContext { get; }
|
||||
|
@ -124,4 +126,4 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
public string LogFragment => "ShardingOptionsExtension";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -15,6 +15,9 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
#if EFCORE6
|
||||
public class ShardingWrapOptionsExtension : IDbContextOptionsExtension
|
||||
{
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace ShardingCore.EFCores.OptionsExtensions
|
|||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
#if EFCORE6
|
||||
public class UnionAllMergeOptionsExtension : IDbContextOptionsExtension
|
||||
{
|
||||
|
|
|
@ -20,6 +20,9 @@ namespace ShardingCore.EFCores
|
|||
* @Ver: 1.0
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
public class ShardingRelationalTransaction : RelationalTransaction
|
||||
{
|
||||
private readonly IShardingDbContext _shardingDbContext;
|
||||
|
|
|
@ -12,6 +12,9 @@ namespace ShardingCore.EFCores
|
|||
* @Date: Saturday, 14 August 2021 10:17:43
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
#if EFCORE5 || EFCORE6
|
||||
public class ShardingDbSetSource : IDbSetSource
|
||||
{
|
||||
|
|
|
@ -26,6 +26,9 @@ namespace ShardingCore.EFCores
|
|||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
public class ShardingInternalDbSet<TEntity> : InternalDbSet<TEntity>
|
||||
where TEntity : class
|
||||
{
|
||||
|
|
|
@ -18,6 +18,9 @@ namespace ShardingCore.EFCores
|
|||
* @Ver: 1.0
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
#if EFCORE6
|
||||
|
||||
public class ShardingRelationalTransactionFactory<TShardingDbContext> : RelationalTransactionFactory where TShardingDbContext : DbContext, IShardingDbContext
|
||||
|
|
|
@ -23,6 +23,9 @@ namespace ShardingCore.Sharding.Parsers.Visitors
|
|||
/// Author: xjm
|
||||
/// Created: 2022/5/1 21:43:12
|
||||
/// Email: 326308290@qq.com
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
internal class ShardingQueryPrepareVisitor : ExpressionVisitor
|
||||
{
|
||||
private readonly IShardingDbContext _shardingDbContext;
|
||||
|
|
|
@ -101,12 +101,8 @@ namespace ShardingCore.Core.Internal.Visitors
|
|||
{
|
||||
if (RootIsVisit&&node.Method.ReturnType.IsMethodReturnTypeQueryableType()&&node.Method.ReturnType.IsGenericType)
|
||||
{
|
||||
#if EFCORE2 || EFCORE3
|
||||
var notRoot = node.Arguments.IsEmpty();
|
||||
#endif
|
||||
#if !EFCORE2 && !EFCORE3
|
||||
var notRoot = node.Arguments.IsEmpty();
|
||||
#endif
|
||||
|
||||
if (notRoot)
|
||||
{
|
||||
var entityType = node.Method.ReturnType.GenericTypeArguments[0];
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Linq.Expressions;
|
||||
//using System.Reflection;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Microsoft.EntityFrameworkCore;
|
||||
//using Microsoft.EntityFrameworkCore.Query;
|
||||
//using ShardingCore.Core.Internal.Visitors;
|
||||
//using ShardingCore.Core.TrackerManagers;
|
||||
//using ShardingCore.Extensions;
|
||||
|
||||
//namespace ShardingCore.Sharding.Visitors.Querys
|
||||
//{
|
||||
// internal class QueryCompileParseVisitors : ExpressionVisitor
|
||||
// {
|
||||
// private readonly ITrackerManager _trackerManager;
|
||||
// private bool? isNoTracking;
|
||||
// private bool isIgnoreFilter;
|
||||
// private readonly ISet<Type> shardingEntities = new HashSet<Type>();
|
||||
|
||||
// public QueryCompileParseVisitors(ITrackerManager trackerManager)
|
||||
// {
|
||||
// _trackerManager = trackerManager;
|
||||
// }
|
||||
|
||||
// public CompileParseResult GetCompileParseResult()
|
||||
// {
|
||||
// return new CompileParseResult(isNoTracking, isIgnoreFilter, shardingEntities);
|
||||
// }
|
||||
//#if EFCORE2 || EFCORE3
|
||||
// protected override Expression VisitConstant(ConstantExpression node)
|
||||
// {
|
||||
// if (node.Value is IQueryable queryable)
|
||||
// {
|
||||
// shardingEntities.Add(queryable.ElementType);
|
||||
// }
|
||||
|
||||
// return base.VisitConstant(node);
|
||||
// }
|
||||
//#endif
|
||||
//#if EFCORE5 || EFCORE6
|
||||
// protected override Expression VisitExtension(Expression node)
|
||||
// {
|
||||
// if (node is QueryRootExpression queryRootExpression)
|
||||
// {
|
||||
// shardingEntities.Add(queryRootExpression.EntityType.ClrType);
|
||||
// }
|
||||
// return base.VisitExtension(node);
|
||||
// }
|
||||
//#endif
|
||||
|
||||
// protected override Expression VisitMember
|
||||
// (MemberExpression memberExpression)
|
||||
// {
|
||||
// // Recurse down to see if we can simplify...
|
||||
// var expression = Visit(memberExpression.Expression);
|
||||
|
||||
// // If we've ended up with a constant, and it's a property or a field,
|
||||
// // we can simplify ourselves to a constant
|
||||
// if (expression is ConstantExpression)
|
||||
// {
|
||||
// object container = ((ConstantExpression)expression).Value;
|
||||
// var member = memberExpression.Member;
|
||||
// if (member is FieldInfo fieldInfo)
|
||||
// {
|
||||
// object value = fieldInfo.GetValue(container);
|
||||
// if (value is IQueryable queryable)
|
||||
// {
|
||||
// shardingEntities.Add(queryable.ElementType);
|
||||
// }
|
||||
// //return Expression.Constant(value);
|
||||
// }
|
||||
// if (member is PropertyInfo propertyInfo)
|
||||
// {
|
||||
// object value = propertyInfo.GetValue(container, null);
|
||||
// if (value is IQueryable queryable)
|
||||
// {
|
||||
// shardingEntities.Add(queryable.ElementType);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return base.VisitMember(memberExpression);
|
||||
// }
|
||||
// protected override Expression VisitMethodCall(MethodCallExpression node)
|
||||
// {
|
||||
// switch (node.Method.Name)
|
||||
// {
|
||||
// case nameof(EntityFrameworkQueryableExtensions.AsNoTracking): isNoTracking = true; break;
|
||||
// case nameof(EntityFrameworkQueryableExtensions.AsTracking): isNoTracking = false; break;
|
||||
// case nameof(EntityFrameworkQueryableExtensions.IgnoreQueryFilters): isIgnoreFilter = true; break;
|
||||
// case nameof(EntityFrameworkQueryableExtensions.Include):
|
||||
// case nameof(EntityFrameworkQueryableExtensions.ThenInclude): DiscoverQueryEntities(node); break;
|
||||
// }
|
||||
|
||||
// return base.VisitMethodCall(node);
|
||||
// }
|
||||
|
||||
// private void DiscoverQueryEntities(MethodCallExpression node)
|
||||
// {
|
||||
// var genericArguments = node.Type.GetGenericArguments();
|
||||
// for (var i = 0; i < genericArguments.Length; i++)
|
||||
// {
|
||||
// var genericArgument = genericArguments[i];
|
||||
// if (typeof(IEnumerable).IsAssignableFrom(genericArgument))
|
||||
// {
|
||||
// var arguments = genericArgument.GetGenericArguments();
|
||||
// foreach (var argument in arguments)
|
||||
// {
|
||||
// //if is db context model
|
||||
// if (_trackerManager.IsDbContextModel(argument))
|
||||
// {
|
||||
// shardingEntities.Add(argument);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (!genericArgument.IsSimpleType())
|
||||
// {
|
||||
// //if is db context model
|
||||
// if (_trackerManager.IsDbContextModel(genericArgument))
|
||||
// {
|
||||
// shardingEntities.Add(genericArgument);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -17,6 +17,9 @@ namespace ShardingCore.Core.Internal.Visitors.Querys
|
|||
* @Date: Saturday, 20 February 2021 11:14:35
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if !EFCORE2 && !EFCORE3 && !EFCORE5 && !EFCORE6
|
||||
error
|
||||
#endif
|
||||
#if EFCORE2 || EFCORE3
|
||||
/// <summary>
|
||||
/// 获取分表类型
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Linq.Expressions;
|
||||
//using Microsoft.EntityFrameworkCore.Query;
|
||||
//using ShardingCore.Extensions;
|
||||
|
||||
//namespace ShardingCore.Core.Internal.Visitors
|
||||
//{
|
||||
///*
|
||||
//* @Author: xjm
|
||||
//* @Description:
|
||||
//* @Date: Wednesday, 13 January 2021 16:26:41
|
||||
//* @Email: 326308290@qq.com
|
||||
//*/
|
||||
//#if !EFCORE5
|
||||
// /// <summary>
|
||||
// /// 获取分表类型
|
||||
// /// </summary>
|
||||
// internal class ShardingEntitiesVisitor : ExpressionVisitor
|
||||
// {
|
||||
// private readonly ISet<Type> _shardingEntities = new HashSet<Type>();
|
||||
|
||||
|
||||
// public ISet<Type> GetShardingEntities()
|
||||
// {
|
||||
// return _shardingEntities;
|
||||
// }
|
||||
// protected override Expression VisitConstant(ConstantExpression node)
|
||||
// {
|
||||
// if (node.Value is IQueryable queryable&&queryable.ElementType.IsShardingTable())
|
||||
// {
|
||||
// _shardingEntities.Add(queryable.ElementType);
|
||||
// }
|
||||
|
||||
// return base.VisitConstant(node);
|
||||
// }
|
||||
// }
|
||||
//#endif
|
||||
|
||||
// #if EFCORE5
|
||||
// /// <summary>
|
||||
// /// 获取分表类型
|
||||
// /// </summary>
|
||||
// internal class ShardingEntitiesVisitor : ExpressionVisitor
|
||||
// {
|
||||
// private readonly ISet<Type> _shardingEntities = new HashSet<Type>();
|
||||
|
||||
|
||||
// public ISet<Type> GetShardingEntities()
|
||||
// {
|
||||
// return _shardingEntities;
|
||||
// }
|
||||
|
||||
// protected override Expression VisitExtension(Expression node)
|
||||
// {
|
||||
// if (node is QueryRootExpression queryRootExpression&&queryRootExpression.EntityType.ClrType.IsShardingTable())
|
||||
// {
|
||||
// _shardingEntities.Add(queryRootExpression.EntityType.ClrType);
|
||||
// }
|
||||
// return base.VisitExtension(node);
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
//}
|
|
@ -28,24 +28,8 @@
|
|||
<Compile Include="..\..\src\ShardingCore\**\*.cs" />
|
||||
<Compile Remove="..\..\src\ShardingCore\obj\**" />
|
||||
<Compile Remove="..\..\src\ShardingCore\bin\**" />
|
||||
<Compile Update="..\..\src\ShardingCore\Sharding\ShardingExecutors\CompileParameter.cs">
|
||||
<Link>Sharding\ShardingExecutors\CompileParameter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Update="..\..\src\ShardingCore\Sharding\ShardingExecutors\CustomerQueryScope.cs">
|
||||
<Link>Sharding\ShardingExecutors\CustomerQueryScope.cs</Link>
|
||||
</Compile>
|
||||
<Compile Update="..\..\src\ShardingCore\Sharding\MergeEngines\Executors\Enumerators\FirstOrDefaultEnumeratorExecutor.cs">
|
||||
<Link>Sharding\MergeEngines\Executors\Enumerators\FirstOrDefaultEnumeratorExecutor.cs</Link>
|
||||
</Compile>
|
||||
<Compile Update="..\..\src\ShardingCore\Sharding\MergeContexts\Paginations\PaginationItem.cs">
|
||||
<Link>Sharding\MergeContexts\Paginations\PaginationItem.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="..\..\src\ShardingCore\ShardingTableConfig.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.27" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>$(EFCORE6)</Version>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<DefineConstants>TRACE;DEBUG;EFCORE6;</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\ShardingCore.6x.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.Relational" Version="6.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue