Skip to content

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

@EmmaCCC

Description

@EmmaCCC

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.g__Logged|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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions