问题提示:System.InvalidOperationException: Null TypeMapping in Sql Tree
日志记录:
System.InvalidOperationException: Null TypeMapping in Sql Tree at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.SqlTypeMappingVerifyingExpressionVisitor.VisitExtension(Expression node) at System.Linq.Expressions.Expression.Accept(ExpressionVisitor visitor) at Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlBinaryExpression.VisitChildren(ExpressionVisitor visitor) at System.Linq.Expressions.ExpressionVisitor.VisitExtension(Expression node) at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.SqlTypeMappingVerifyingExpressionVisitor.VisitExtension(Expression node) at System.Linq.Expressions.Expression.Accept(ExpressionVisitor visitor) at Microsoft.EntityFrameworkCore.Query.RelationalSqlTranslatingExpressionVisitor.Translate(Expression expression) at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateExpression(Expression expression) at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateLambdaExpression(ShapedQueryExpression shapedQueryExpression, LambdaExpression lambdaExpression) at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.TranslateWhere(ShapedQueryExpression source, LambdaExpression predicate) at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFramewor...
为什么会出现?我这边的操作是拖拽修改顺序
实现代码:
public async Task MoveOrganizationUnit(MoveNodeInput<long> input) { var source = await _organizationUnitRepository.GetAsync(input.SourceId); var query = _organizationUnitRepository.GetAll(); await Task.Run(() => { _organizationUnitRepository.MoveNode<ExtendedOrganizationUnit, long, long?>(input.SourceId, input.TargetId, input.DropPosition, query); }); }
MoveNode方法:
public static TEntity MoveNode<TEntity, TPrimaryKey, TParentKey>(this IRepository<TEntity, TPrimaryKey> repository, TPrimaryKey sourceNodeId, TParentKey targetNodeId, NodeMoveType moveType, IQueryable<TEntity> query = null) where TEntity : class, ISimpleTreeEntity<TEntity, TPrimaryKey, TParentKey>, IEntity<TPrimaryKey> { repository.ResetNodes<TEntity, TPrimaryKey, TParentKey>(null, query); var sourceNode = repository.Get(sourceNodeId); var targetNode = targetNodeId == null ? null : repository.Get((TPrimaryKey)(object)targetNodeId); return repository.MoveNode<TEntity, TPrimaryKey, TParentKey>(sourceNode, targetNode, moveType, query); }
该问题待解决中。。。。。。