high performance lightweight solution for efcore sharding table and sharding database support read-write-separation .一款ef-core下高性能、轻量级针对分表分库读写分离的解决方案,具有零依赖、零学习成本、零业务代码入侵
这种查询 我看efcore8 是支持的,我这项目引入shardingcore报错,Cannot create a DbSet for 'SystemConfigTmp' because this type is not included in the model for the context ,去掉之后就好了,我用的
这个模型就是没在DbContext中,ef7也是不支持的,但是ef8支持任意的CLR类型
下边是堆栈信息:
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)
这种查询 我看efcore8 是支持的,我这项目引入shardingcore报错,Cannot create a DbSet for 'SystemConfigTmp' because this type is not included in the model for the context ,去掉之后就好了,我用的 这个模型就是没在DbContext中,ef7也是不支持的,但是ef8支持任意的CLR类型 下边是堆栈信息: System.InvalidOperationException: Cannot create a DbSet for 'SystemConfigTmp' because this type is not included in the model for the context. at Microsoft.EntityFrameworkCore.Internal.InternalDbSetgLogged|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.g Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
1.get_EntityType() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet
1.CheckState() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityQueryable() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet
1.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.ConfiguredCancelableAsyncEnumerable
1.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.