添加对.netstandard2.0和.netstandard2.1的支持

This commit is contained in:
xuejiaming 2022-09-29 09:06:30 +08:00
parent 16046d357b
commit c2f14e3a76
24 changed files with 144 additions and 144 deletions

View File

@ -44,9 +44,9 @@ Release | EF Core | .NET | .NET (Core)
Release | .NET (Core)
--- | ---
[6.x.x.x](https://www.nuget.org/packages/ShardingCore) | 6.0
[5.x.x.x](https://www.nuget.org/packages/ShardingCore) | 5.0
[3.x.x.x](https://www.nuget.org/packages/ShardingCore) | netcoreapp3
[6.x.x.x](https://www.nuget.org/packages/ShardingCore) | net6
[5.x.x.x](https://www.nuget.org/packages/ShardingCore) | net5 or netstandard2.1
[3.x.x.x](https://www.nuget.org/packages/ShardingCore) | netcoreapp3 or netstandard2.0
[2.x.x.x](https://www.nuget.org/packages/ShardingCore) | netcoreapp2

View File

@ -43,9 +43,9 @@ Use Condition Compile With NetFramework not
Release | .NET (Core)
--- | ---
[6.x.x.x](https://www.nuget.org/packages/ShardingCore) | 6.0
[5.x.x.x](https://www.nuget.org/packages/ShardingCore) | 5.0
[3.x.x.x](https://www.nuget.org/packages/ShardingCore) | netcoreapp3
[6.x.x.x](https://www.nuget.org/packages/ShardingCore) | net6
[5.x.x.x](https://www.nuget.org/packages/ShardingCore) | net5 or netstandard2.1
[3.x.x.x](https://www.nuget.org/packages/ShardingCore) | netcoreapp3 or netstandard2.0
[2.x.x.x](https://www.nuget.org/packages/ShardingCore) | netcoreapp2
## Quick start

View File

@ -20,7 +20,7 @@ namespace ShardingCore.EFCores.ChangeTrackers
_dbContext = context;
}
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
@ -122,7 +122,7 @@ namespace ShardingCore.EFCores.ChangeTrackers
}
#endif
#if !NETCOREAPP2_0 && !NETCOREAPP3_0
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_0
public override void Clear()
{
if (_dbContext is IShardingDbContext)

View File

@ -1,4 +1,4 @@
#if NETCOREAPP3_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NETSTANDARD2_0
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;

View File

@ -1,4 +1,4 @@
#if NETCOREAPP3_0
#if NETCOREAPP3_0 || NETSTANDARD2_0
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;

View File

@ -1,4 +1,4 @@
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

View File

@ -14,7 +14,7 @@ namespace ShardingCore.EFCores.OptionsExtensions
* @Ver: 1.0
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
@ -63,7 +63,7 @@ namespace ShardingCore.EFCores.OptionsExtensions
}
}
#endif
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
public class ShardingOptionsExtension: IDbContextOptionsExtension
{
public IShardingRuntimeContext ShardingRuntimeContext { get; }

View File

@ -15,7 +15,7 @@ namespace ShardingCore.EFCores.OptionsExtensions
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
#if NET6_0
@ -55,7 +55,7 @@ namespace ShardingCore.EFCores.OptionsExtensions
}
}
#endif
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
public class ShardingWrapOptionsExtension: IDbContextOptionsExtension
{

View File

@ -14,7 +14,7 @@ namespace ShardingCore.EFCores.OptionsExtensions
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
#if NET6_0
@ -50,7 +50,7 @@ namespace ShardingCore.EFCores.OptionsExtensions
}
}
#endif
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
public class UnionAllMergeOptionsExtension: IDbContextOptionsExtension
{

View File

@ -20,7 +20,7 @@ namespace ShardingCore.EFCores
* @Ver: 1.0
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
public class ShardingRelationalTransaction : RelationalTransaction
@ -34,7 +34,7 @@ namespace ShardingCore.EFCores
}
#endif
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
public ShardingRelationalTransaction(IShardingDbContext shardingDbContext, IRelationalConnection connection,
DbTransaction transaction, Guid transactionId,
IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> logger, bool transactionOwned) : base(connection,

View File

@ -12,10 +12,10 @@ namespace ShardingCore.EFCores
* @Date: Saturday, 14 August 2021 10:17:43
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
#if NET5_0 || NET6_0
#if NET5_0 || NETSTANDARD2_1 || NET6_0
public class ShardingDbSetSource : IDbSetSource
{
@ -55,7 +55,7 @@ namespace ShardingCore.EFCores
=> (c, name) => new ShardingInternalDbSet<TEntity>(c, name);
}
#endif
#if NETCOREAPP3_0
#if NETCOREAPP3_0 || NETSTANDARD2_0
public class ShardingDbSetSource:IDbSetSource
{

View File

@ -26,7 +26,7 @@ namespace ShardingCore.EFCores
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
public class ShardingInternalDbSet<TEntity> : InternalDbSet<TEntity>
@ -36,7 +36,7 @@ namespace ShardingCore.EFCores
private readonly IShardingRuntimeContext _shardingRuntimeContext;
private LocalView<TEntity>? _localView;
#if NET5_0 || NET6_0
#if NET5_0 || NETSTANDARD2_1 || NET6_0
public ShardingInternalDbSet(DbContext context, string entityTypeName) : base(context, entityTypeName)
{
@ -44,7 +44,7 @@ namespace ShardingCore.EFCores
_shardingRuntimeContext = context.GetShardingRuntimeContext();
}
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0
public ShardingInternalDbSet(DbContext context) : base(context)
{
_context = (IShardingDbContext)context;

View File

@ -35,7 +35,7 @@ namespace ShardingCore.EFCores
{
private readonly IShardingRuntimeContext _shardingRuntimeContext;
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
@ -46,14 +46,14 @@ namespace ShardingCore.EFCores
}
#endif
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
public ShardingMigrator(IShardingRuntimeContext shardingRuntimeContext, IMigrationsAssembly migrationsAssembly, IHistoryRepository historyRepository, IDatabaseCreator databaseCreator, IMigrationsSqlGenerator migrationsSqlGenerator, IRawSqlCommandBuilder rawSqlCommandBuilder, IMigrationCommandExecutor migrationCommandExecutor, IRelationalConnection connection, ISqlGenerationHelper sqlGenerationHelper, ICurrentDbContext currentContext, IConventionSetBuilder conventionSetBuilder, IDiagnosticsLogger<DbLoggerCategory.Migrations> logger, IDiagnosticsLogger<DbLoggerCategory.Database.Command> commandLogger, IDatabaseProvider databaseProvider) : base(migrationsAssembly, historyRepository, databaseCreator, migrationsSqlGenerator, rawSqlCommandBuilder, migrationCommandExecutor, connection, sqlGenerationHelper, currentContext, conventionSetBuilder, logger, commandLogger, databaseProvider)
{
_shardingRuntimeContext = shardingRuntimeContext;
}
#endif
#if NETCOREAPP3_0
#if NETCOREAPP3_0 || NETSTANDARD2_0
public ShardingMigrator(IShardingRuntimeContext shardingRuntimeContext, IMigrationsAssembly migrationsAssembly, IHistoryRepository historyRepository, IDatabaseCreator databaseCreator, IMigrationsSqlGenerator migrationsSqlGenerator, IRawSqlCommandBuilder rawSqlCommandBuilder, IMigrationCommandExecutor migrationCommandExecutor, IRelationalConnection connection, ISqlGenerationHelper sqlGenerationHelper, ICurrentDbContext currentContext, IDiagnosticsLogger<DbLoggerCategory.Migrations> logger, IDiagnosticsLogger<DbLoggerCategory.Database.Command> commandLogger, IDatabaseProvider databaseProvider) : base(migrationsAssembly, historyRepository, databaseCreator, migrationsSqlGenerator, rawSqlCommandBuilder, migrationCommandExecutor, connection, sqlGenerationHelper, currentContext, logger, commandLogger, databaseProvider)
{
_shardingRuntimeContext = shardingRuntimeContext;
@ -81,7 +81,7 @@ namespace ShardingCore.EFCores
await DynamicShardingHelper.DynamicMigrateWithDataSourcesAsync(_shardingRuntimeContext, allDataSourceNames, null,cancellationToken);
}
#if NET6_0 || NET5_0
#if NET6_0 || NET5_0 || NETSTANDARD2_1
public override string GenerateScript(string fromMigration = null, string toMigration = null,
MigrationsSqlGenerationOptions options = MigrationsSqlGenerationOptions.Default)
@ -89,7 +89,7 @@ namespace ShardingCore.EFCores
return new ScriptMigrationGenerator(_shardingRuntimeContext, fromMigration, toMigration, options).GenerateScript();
}
#endif
#if NETCOREAPP3_0 || NETCOREAPP2_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NETCOREAPP2_0
public override string GenerateScript(string fromMigration = null, string toMigration = null, bool idempotent = false)
{
return new ScriptMigrationGenerator(_shardingRuntimeContext, fromMigration, toMigration, idempotent).GenerateScript();

View File

@ -18,7 +18,7 @@ namespace ShardingCore.EFCores
* @Ver: 1.0
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
#if NET6_0
@ -38,7 +38,7 @@ namespace ShardingCore.EFCores
}
}
#endif
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
public class ShardingRelationalTransactionFactory<TShardingDbContext> : RelationalTransactionFactory where TShardingDbContext : DbContext, IShardingDbContext
{

View File

@ -112,7 +112,7 @@ namespace ShardingCore.EFCores
_shardingDbContext.NotifyShardingTransaction();
return dbContextTransaction;
}
#if !NETCOREAPP3_0
#if !NETCOREAPP3_0 && !NETSTANDARD2_0
public Task CommitTransactionAsync(CancellationToken cancellationToken = new CancellationToken())
{

View File

@ -32,14 +32,14 @@ namespace ShardingCore.Extensions
/// <param name="dbContext"></param>
public static void RemoveDbContextRelationModelThatIsShardingTable(this DbContext dbContext)
{
#if !NETCOREAPP2_0&&!NETCOREAPP3_0&&!NET5_0&&!NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
throw new NotImplementedException();
#endif
#if NET6_0
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NET5_0
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0 || NET5_0 || NETSTANDARD2_1
var contextModel = dbContext.Model as Model;
#endif
@ -55,7 +55,7 @@ namespace ShardingCore.Extensions
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
}
#endif
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
var valueTuples =
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => entityMetadataManager.IsShardingTable(m.EntityType.ClrType))).Select(o => o.Key).ToList();
@ -64,7 +64,7 @@ namespace ShardingCore.Extensions
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
}
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
var entityTypes =
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
var list = entityTypes.Where(o=>entityMetadataManager.IsShardingTable(o.Value.ClrType)).Select(o=>o.Key).ToList();
@ -109,14 +109,14 @@ namespace ShardingCore.Extensions
/// <param name="dbContext"></param>
public static void RemoveDbContextAllRelationModelWithoutShardingDataSourceOnly(this DbContext dbContext)
{
#if !NETCOREAPP2_0&&!NETCOREAPP3_0&&!NET5_0&&!NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
throw new NotImplementedException();
#endif
#if NET6_0
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NET5_0
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
var contextModel = dbContext.Model as Model;
#endif
@ -132,7 +132,7 @@ namespace ShardingCore.Extensions
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
}
#endif
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
var valueTuples =
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsShardingDataSource(m.EntityType.ClrType)||entityMetadataManager.TryGet(m.EntityType.ClrType)==null)).Select(o => o.Key).ToList();
@ -141,7 +141,7 @@ namespace ShardingCore.Extensions
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
}
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
var entityTypes =
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
var list = entityTypes.Where(o => !entityMetadataManager.IsShardingDataSource(o.Value.ClrType) || entityMetadataManager.TryGet(o.Value.ClrType) == null).Select(o => o.Key).ToList();
@ -157,14 +157,14 @@ namespace ShardingCore.Extensions
/// <param name="dbContext"></param>
public static void RemoveDbContextAllRelationModel(this DbContext dbContext)
{
#if !NETCOREAPP2_0&&!NETCOREAPP3_0&&!NET5_0&&!NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
throw new NotImplementedException();
#endif
#if NET6_0
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NET5_0
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
var contextModel = dbContext.Model as Model;
#endif
@ -173,11 +173,11 @@ namespace ShardingCore.Extensions
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
contextModelRelationalModel.Tables.Clear();
#endif
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
contextModelRelationalModel.Tables.Clear();
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0
var entityTypes =
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
entityTypes.Clear();
@ -192,10 +192,10 @@ namespace ShardingCore.Extensions
public static void RemoveDbContextRelationModelSaveOnlyThatIsNamedType(this DbContext dbContext,
Type shardingType)
{
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
1
#endif
#if NETCOREAPP2_0 ||NETCOREAPP3_0 ||NET5_0
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0 ||NET5_0 || NETSTANDARD2_1
var contextModel = dbContext.Model as Model;
#endif
@ -220,7 +220,7 @@ namespace ShardingCore.Extensions
}
#endif
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
var entityTypes = contextModel.GetEntityTypes();
@ -239,7 +239,7 @@ namespace ShardingCore.Extensions
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
}
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
var entityTypes =
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
@ -270,7 +270,7 @@ namespace ShardingCore.Extensions
/// <param name="dbContext"></param>
public static void RemoveModelCache(this DbContext dbContext)
{
#if !NETCOREAPP2_0&&!NETCOREAPP3_0&&!NET5_0&&!NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
throw new NotImplementedException();
#endif
#if NET6_0
@ -281,13 +281,13 @@ namespace ShardingCore.Extensions
object key2 = modelCacheKeyFactory.Create(dbContext,false);
shardingModelSource.Remove(key2);
#endif
#if NET5_0
#if NET5_0 || NETSTANDARD2_1
var shardingModelSource = dbContext.GetService<IModelSource>() as IShardingModelSource;
var modelCacheKeyFactory = shardingModelSource.GetModelCacheKeyFactory();
object key1 = modelCacheKeyFactory.Create(dbContext);
shardingModelSource.Remove(key1);
#endif
#if NETCOREAPP3_0
#if NETCOREAPP3_0 || NETSTANDARD2_0
var shardingModelSource = dbContext.GetService<IModelSource>() as IShardingModelSource;
var modelCacheKeyFactory = shardingModelSource.GetModelCacheKeyFactory();

View File

@ -16,7 +16,7 @@ namespace ShardingCore.Extensions
//public static void ForEach<T>(this IEnumerable<T> source)
#if !NET5_0
#if !NET5_0 || NETSTANDARD2_1
public static HashSet<TSource> ToHashSet<TSource>(
this IEnumerable<TSource> source,
IEqualityComparer<TSource> comparer = null)

View File

@ -30,7 +30,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
_moveIndex++;
return HasElement();
}
#if !NETCOREAPP2_0&&!NETCOREAPP3_0&&!NET5_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NET5_0 && !NETSTANDARD2_1
public ValueTask DisposeAsync()
{
return ValueTask.CompletedTask;
@ -46,7 +46,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
}
#endif
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
public ValueTask DisposeAsync()
{
return new ValueTask();

View File

@ -23,7 +23,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
/// Author: xjm
/// Created: 2022/5/1 21:43:12
/// Email: 326308290@qq.com
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
internal class ShardingQueryPrepareVisitor : ExpressionVisitor
@ -57,7 +57,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
shardingQueryableAsSequenceOptions,
shardingEntities, isNoTracking, isIgnoreFilter);
}
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
protected override Expression VisitConstant(ConstantExpression node)
{
if (node.Value is IQueryable queryable)
@ -68,7 +68,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
return base.VisitConstant(node);
}
#endif
#if NET5_0 || NET6_0
#if NET5_0 || NETSTANDARD2_1 || NET6_0
protected override Expression VisitExtension(Expression node)
{
if (node is QueryRootExpression queryRootExpression)

View File

@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Internal;
#if NETCOREAPP3_0
#if NETCOREAPP3_0 || NETSTANDARD2_0
using Microsoft.EntityFrameworkCore.Query.Internal;
#endif

View File

@ -153,7 +153,7 @@ namespace ShardingCore.Core.Internal.Visitors
}
}
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0
internal class DbContextReplaceQueryableVisitor : DbContextInnerMemberReferenceReplaceQueryableVisitor
{
private readonly DbContext _dbContext;
@ -193,7 +193,7 @@ namespace ShardingCore.Core.Internal.Visitors
}
#endif
#if NET5_0 || NET6_0
#if NET5_0 || NETSTANDARD2_1 || NET6_0
internal class DbContextReplaceQueryableVisitor : DbContextInnerMemberReferenceReplaceQueryableVisitor
{
private readonly DbContext _dbContext;

View File

@ -17,10 +17,10 @@ namespace ShardingCore.Core.Internal.Visitors.Querys
* @Date: Saturday, 20 February 2021 11:14:35
* @Email: 326308290@qq.com
*/
#if !NETCOREAPP2_0 && !NETCOREAPP3_0 && !NET5_0 && !NET6_0
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
error
#endif
#if NETCOREAPP2_0 || NETCOREAPP3_0
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0
/// <summary>
/// 获取分表类型
/// </summary>
@ -117,7 +117,7 @@ namespace ShardingCore.Core.Internal.Visitors.Querys
}
#endif
#if NET5_0 || NET6_0
#if NET5_0 || NETSTANDARD2_1 || NET6_0
/// <summary>
/// 获取分表类型
/// </summary>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2;netcoreapp3;net5;net6</TargetFrameworks>
<TargetFrameworks>netcoreapp2;netcoreapp3;netstandard2.0;netstandard2.1;net5;net6</TargetFrameworks>
<Version>$(SHARDINGCORE)</Version>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<DefineConstants>TRACE;DEBUG;</DefineConstants>
@ -13,13 +13,13 @@
<DocumentationFile>bin\Release\ShardingCore.2x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and '$(TargetFramework)' == 'netcoreapp3'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and ('$(TargetFramework)' == 'netcoreapp3' or '$(TargetFramework)' == 'netstandard2.0')">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DocumentationFile>bin\Release\ShardingCore.3x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and '$(TargetFramework)' == 'net5'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and ('$(TargetFramework)' == 'net5' or '$(TargetFramework)' == 'netstandard2.1')">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DocumentationFile>bin\Release\ShardingCore.5x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
@ -78,11 +78,11 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.*"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.*"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.*"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.*"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5'">
<ItemGroup Condition="'$(TargetFramework)' == 'net5' or '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.*"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.*"/>
</ItemGroup>