Closed chukaif closed 2 months ago
这个好像不是shardingcore报的错但是sharding-core确实不支持导航属性比如一对一一对多等如果你这个对象是分表的话不是的话是可以的
这个好像不是shardingcore报的错但是sharding-core确实不支持导航属性比如一对一一对多等如果你这个对象是分表的话不是的话是可以的
好像是不能正确翻译sql,json列本质上还是字符类型,不知道后续能否支持?
@chukaif 是否可以给一个最小复现demo+code-first的github例子,我后续做支持
@xuejmnet 我重新试了下发现只是在 Furion框架中使用时会出现此问题,不使用任何框架的情况下则查询json列没有任何问题,这就比较头疼了
@chukaif 你可以看看是不是因为本次查询夸两张表了比如命中了两张表导致不行
@xuejmnet 问题解决了,不是ShardingCore的问题,也不是Furion的问题,而是EF的问题,作为json列映射的类当中不能有叫 Id 的属性,有就出错!
我用的SqlServer,当我在表中包含json列时,查询会出错
fail: 2024-08-30 15:56:38.2333309 +08:00 星期五 L System.Logging.FriendlyException[0] #10 '00-cdd72b9719fd045a723e630b1a086e96-c99e5eb0704a4d13-00' [Furion.dll] async Task Microsoft.AspNetCore.Mvc.Filters.FriendlyExceptionFilter.OnExceptionAsync(ExceptionContext context) Expression of type 'System.Object' cannot be used for assignment to type 'System.Int32' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ System.ArgumentException: Expression of type 'System.Object' cannot be used for assignment to type 'System.Int32' at System.Linq.Expressions.Expression.Assign(Expression left, Expression right) at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right, Boolean liftToNull, MethodInfo method, LambdaExpression conversion) at System.Linq.Expressions.BinaryExpression.Update(Expression left, LambdaExpression conversion, Expression right) at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block) at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitConditional(ConditionalExpression node) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block) at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block) at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitConditional(ConditionalExpression node) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block) at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block) at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression.GetEnumerator()
at System.Collections.Generic.List
1 node) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitExtension(Expression extensionExpression) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.ProcessShaper(Expression shaperExpression, RelationalCommandCache& relationalCommandCache, IReadOnlyList
1& readerColumns, LambdaExpression& relatedDataLoaders, Int32& collectionId) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.VisitShapedQuery(ShapedQueryExpression shapedQueryExpression) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.VisitExtension(Expression extensionExpression) at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.VisitExtension(Expression extensionExpression) at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query) at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_01.<Execute>b__0() at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func
1 compiler) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) at ShardingCore.Sharding.ShardingExecutors.DefaultShardingTrackQueryExecutor.Execute[TResult](IQueryCompilerContext queryCompilerContext) at ShardingCore.Sharding.ShardingExecutors.DefaultShardingCompilerExecutor.Execute[TResult](IShardingDbContext shardingDbContext, Expression query) at ShardingCore.EFCores.ShardingQueryCompiler.Execute[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable1.GetEnumerator() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet
1.System.Collections.Generic.IEnumerable1..ctor(IEnumerable
1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)