dotnetcore / sharding-core

high performance lightweight solution for efcore sharding table and sharding database support read-write-separation .一款ef-core下高性能、轻量级针对分表分库读写分离的解决方案,具有零依赖、零学习成本、零业务代码入侵
https://xuejmnet.github.io/sharding-core-doc/
Apache License 2.0
1.17k stars 171 forks source link

任意类型的CLR类不支持查询 #282

Closed EmmaCCC closed 8 hours ago

EmmaCCC commented 1 month ago

220076417cdd407e7afefbf1d3222d79 这种查询 我看efcore8 是支持的,我这项目引入shardingcore报错,Cannot create a DbSet for 'SystemConfigTmp' because this type is not included in the model for the context ,去掉之后就好了,我用的 28d4293de4faef3f894aaad1cc4526aa 这个模型就是没在DbContext中,ef7也是不支持的,但是ef8支持任意的CLR类型 f1e05e245955cb423f78d04b521360f6 下边是堆栈信息: System.InvalidOperationException: Cannot create a DbSet for 'SystemConfigTmp' because this type is not included in the model for the context. at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityType() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.CheckState() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityQueryable() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.System.Linq.IQueryable.get_Provider() at ShardingCore.Core.Internal.Visitors.DbContextReplaceQueryableVisitor.VisitExtension(Expression node) at ShardingCore.Extensions.IShardingQueryableExtension.ReplaceDbContextExpression(Expression queryExpression, DbContext dbContext) at ShardingCore.Sharding.ShardingExecutors.QueryCompilerExecutor..ctor(DbContext dbContext, Expression queryExpression) at ShardingCore.Sharding.ShardingExecutors.QueryCompilerContext.GetQueryCompilerExecutor() at ShardingCore.Sharding.ShardingExecutors.QueryCompilerContextFactory.Create(IPrepareParseResult prepareParseResult) at ShardingCore.Sharding.ShardingExecutors.DefaultShardingCompilerExecutor.ExecuteAsync[TResult](IShardingDbContext shardingDbContext, Expression query, CancellationToken cancellationToken) at ShardingCore.EFCores.ShardingQueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable1.GetAsyncEnumerator(CancellationToken cancellationToken) at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable1.GetAsyncEnumerator() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken) at LinkDuoo.LK.Eshop.Service.SystemSecurity.SystemConfigService.GetInfo(GetSystemConfigDto dto) in D:\Projects\Work\LinkDuoo.DCC\src\LinkDuoo.DCC.Erp.Service\Basic\SystemConfigService.cs:line 40 at LinkDuoo.DCC.Erp.ManageApi.Controllers.Basic.SystemConfigController.GetInfo(GetSystemConfigDto dto) in D:\Projects\Work\LinkDuoo.DCC\src\LinkDuoo.DCC.Erp.ManageApi\Controllers\Basic\SystemConfigController.cs:line 45 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gLogged|12_1(ControllerActionInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

xuejmnet commented 1 month ago

@EmmaCCC 已修复7.x.1.22