• System.InvalidOperationException: Null TypeMapping in Sql Tree


    问题提示: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);
            }

    该问题待解决中。。。。。。

  • 相关阅读:
    2021/1/10周总结一
    java基础复习五
    java基础复习四
    构建之法读书笔记三
    javaweb学生教务系统
    java基础复习三
    关于eclipse项目错误的一些小经验总结
    Java基础复习二
    JavaDoc文档
    2017-2018-2 20179216 《网络攻防与实践》 第四周总结
  • 原文地址:https://www.cnblogs.com/gzbit-zxx/p/13438396.html
Copyright © 2020-2023  润新知