diff --git a/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContextFactory.cs b/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContextFactory.cs index b399e11d..96d80011 100644 --- a/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContextFactory.cs +++ b/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContextFactory.cs @@ -28,6 +28,8 @@ namespace ShardingCore.Sharding.ShardingExecutors private static readonly IQueryableCombine _constantQueryableCombine; private static readonly IQueryableCombine _selectQueryableCombine; private static readonly IQueryableCombine _whereQueryableCombine; + private static readonly IQueryableCombine _executeUpdateQueryableCombine; + private static readonly IQueryableCombine _executeDeleteQueryableCombine; static QueryCompilerContextFactory() { @@ -36,6 +38,8 @@ namespace ShardingCore.Sharding.ShardingExecutors _constantQueryableCombine = new ConstantQueryableCombine(); _selectQueryableCombine = new SelectQueryableCombine(); _whereQueryableCombine = new WhereQueryableCombine(); + _executeUpdateQueryableCombine = new ExecuteUpdateQueryableCombine(); + _executeDeleteQueryableCombine = new ExecuteDeleteQueryableCombine(); } public QueryCompilerContextFactory(IDataSourceRouteRuleEngineFactory dataSourceRouteRuleEngineFactory,ITableRouteRuleEngineFactory tableRouteRuleEngineFactory,ILogger logger) @@ -114,6 +118,10 @@ namespace ShardingCore.Sharding.ShardingExecutors case nameof(Queryable.LongCount): case nameof(Queryable.Any): return _whereQueryableCombine; + case "ExecuteUpdate": + return _executeUpdateQueryableCombine; + case "ExecuteDelete": + return _executeDeleteQueryableCombine; case nameof(Queryable.All): return _allQueryableCombine; case nameof(Queryable.Max): diff --git a/src/ShardingCore/Sharding/ShardingExecutors/QueryableCombines/ExecuteDeleteQueryableCombine.cs b/src/ShardingCore/Sharding/ShardingExecutors/QueryableCombines/ExecuteDeleteQueryableCombine.cs new file mode 100644 index 00000000..1d9e1e37 --- /dev/null +++ b/src/ShardingCore/Sharding/ShardingExecutors/QueryableCombines/ExecuteDeleteQueryableCombine.cs @@ -0,0 +1,15 @@ +using System.Linq; +using System.Linq.Expressions; +using ShardingCore.Sharding.ShardingExecutors.Abstractions; + +namespace ShardingCore.Sharding.ShardingExecutors.QueryableCombines +{ + public class ExecuteDeleteQueryableCombine: AbstractQueryableCombine + { + public override IQueryable DoCombineQueryable(IQueryable queryable, Expression secondExpression, + IQueryCompilerContext queryCompilerContext) + { + return queryable; + } + } +} diff --git a/src/ShardingCore/Sharding/ShardingExecutors/QueryableCombines/ExecuteUpdateQueryableCombine.cs b/src/ShardingCore/Sharding/ShardingExecutors/QueryableCombines/ExecuteUpdateQueryableCombine.cs new file mode 100644 index 00000000..8dbcf361 --- /dev/null +++ b/src/ShardingCore/Sharding/ShardingExecutors/QueryableCombines/ExecuteUpdateQueryableCombine.cs @@ -0,0 +1,15 @@ +using System.Linq; +using System.Linq.Expressions; +using ShardingCore.Sharding.ShardingExecutors.Abstractions; + +namespace ShardingCore.Sharding.ShardingExecutors.QueryableCombines +{ + public class ExecuteUpdateQueryableCombine: AbstractQueryableCombine + { + public override IQueryable DoCombineQueryable(IQueryable queryable, Expression secondExpression, + IQueryCompilerContext queryCompilerContext) + { + return queryable; + } + } +}