尝试对select非nullable的值进行过滤 #136

This commit is contained in:
xuejiaming 2022-05-21 13:16:16 +08:00
parent c4d2439c79
commit 4284b54c7d
4 changed files with 29 additions and 102 deletions

View File

@ -95,7 +95,8 @@ namespace Sample.SqlServer.Controllers
// };
//var listAsync = await sql.ToListAsync();
//var resultx112331tt = await _defaultTableDbContext.Set<SysTest>().AsNoTracking().CountAsync();
var resultx112331tt112 = await _defaultTableDbContext.Set<SysUserMod>().FirstOrDefaultAsync();
var resultx112331tt2 = await _defaultTableDbContext.Set<SysTest>().FirstOrDefaultAsync(o => o.Id == "2");
var resultx112331ttaa2 = await _defaultTableDbContext.Set<SysTest>().FirstOrDefaultAsync(o => o.Id == "2");
resultx112331ttaa2.UserId = "zzzz";

View File

@ -21,7 +21,6 @@ using ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine;
using ShardingCore.DIExtensions;
using ShardingCore.EFCores;
using ShardingCore.EFCores.OptionsExtensions;
using ShardingCore.Helpers;
using ShardingCore.Jobs;
using ShardingCore.Sharding;
using ShardingCore.Sharding.Abstractions;

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShardingCore.Sharding.MergeEngines.Executors.Methods.Abstractions
{
/// <summary>
///
/// </summary>
/// Author: xjm
/// Created: 2022/5/21 12:56:20
/// Email: 326308290@qq.com
public class OneMethodResult<TEntity>
{
public OneMethodResult(TEntity entity)
{
Entity = entity;
}
/// <summary>
/// 查询结果
/// </summary>
public TEntity Entity { get; }
}
}

View File

@ -1,100 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq.Expressions;
//using ShardingCore.Core;
//using ShardingCore.Core.QueryRouteManagers;
//using ShardingCore.Extensions;
//using ShardingCore.Sharding.Abstractions;
//using ShardingCore.Sharding.ShardingExecutors.Abstractions;
//using ShardingCore.Sharding.Visitors.ShardingExtractParameters;
///*
//* @Author: xjm
//* @Description:
//* @Date: DATE TIME
//* @Email: 326308290@qq.com
//*/
//namespace ShardingCore.ShardingExecutors
//{
// public class CompileParameter:ICompileParameter,IPrint
// {
// private readonly IShardingDbContext _shardingDbContext;
// private readonly Expression _nativeQueryExpression;
// private readonly bool _useUnionAllMerge;
// private readonly int? _maxQueryConnectionsLimit;
// private readonly ConnectionModeEnum? _connectionMode;
// private readonly bool? _readOnly;
// private readonly Action<ShardingRouteContext> _shardingRouteConfigure;
// private readonly bool? _isSequence;
// private readonly bool? _sameWithShardingComparer;
// public CompileParameter(IShardingDbContext shardingDbContext,Expression shardingQueryExpression)
// {
// _shardingDbContext = shardingDbContext;
// var shardingQueryableExtractParameter = new ShardingQueryableExtractParameterVisitor();
// _nativeQueryExpression = shardingQueryableExtractParameter.Visit(shardingQueryExpression);
// var extractShardingParameter = shardingQueryableExtractParameter.ExtractShardingParameter();
// _shardingRouteConfigure = extractShardingParameter.ShardingQueryableAsRouteOptions?.RouteConfigure;
// _useUnionAllMerge = extractShardingParameter.UseUnionAllMerge;
// _maxQueryConnectionsLimit = extractShardingParameter.ShardingQueryableUseConnectionModeOptions?.MaxQueryConnectionsLimit;
// _connectionMode = extractShardingParameter.ShardingQueryableUseConnectionModeOptions?.ConnectionMode;
// if (shardingDbContext.IsUseReadWriteSeparation())
// {
// _readOnly = extractShardingParameter?.ShardingQueryableReadWriteSeparationOptions?.RouteReadConnect??shardingDbContext.CurrentIsReadWriteSeparation();
// }
// _isSequence = extractShardingParameter.ShardingQueryableAsSequenceOptions?.AsSequence;
// _sameWithShardingComparer = extractShardingParameter.ShardingQueryableAsSequenceOptions
// ?.SameWithShardingComparer;
// }
// public IShardingDbContext GetShardingDbContext()
// {
// return _shardingDbContext;
// }
// public Expression GetNativeQueryExpression()
// {
// return _nativeQueryExpression;
// }
// public bool UseUnionAllMerge()
// {
// return _useUnionAllMerge;
// }
// public int? GetMaxQueryConnectionsLimit()
// {
// return _maxQueryConnectionsLimit;
// }
// public ConnectionModeEnum? GetConnectionMode()
// {
// return _connectionMode;
// }
// public bool? ReadOnly()
// {
// return _readOnly;
// }
// public Action<ShardingRouteContext> GetAsRoute()
// {
// return _shardingRouteConfigure;
// }
// public bool? IsSequence()
// {
// return _isSequence;
// }
// public bool? SameWithShardingComparer()
// {
// return _sameWithShardingComparer;
// }
// public string GetPrintInfo()
// {
// return $"is not support :{_useUnionAllMerge},max query connections limit:{_maxQueryConnectionsLimit},connection mode:{_connectionMode},readonly:{_readOnly},as route:{_shardingRouteConfigure!=null},is sequence:{_isSequence},same with sharding comparer:{_sameWithShardingComparer}";
// }
// }
//}