zoukankan      html  css  js  c++  java
  • ABP记录被删除调用Repository.Get报错

    如果这条数据被删除了下面这样调用报错

    _schoolInformationRepository.Get(admin.SchoolId.Value)?.SchoolName;

    EvaluationSystem.CustomeExceptionFilter - There is no such an entity. Entity type: EvaluationSystem.EntityDesign.SchoolInformation, id: 99c2b418-4083-aa1f-ad54-39f594c78790
    Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: EvaluationSystem.EntityDesign.SchoolInformation, id: 99c2b418-4083-aa1f-ad54-39f594c78790
    at Abp.Domain.Repositories.AbpRepositoryBase`2.Get(TPrimaryKey id)
    at Castle.Proxies.Invocations.IRepository`2_Get_27.InvokeMethodOnTarget()
    at Castle.DynamicProxy.AbstractInvocation.Proceed()
    at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation)
    at Castle.DynamicProxy.AbstractInvocation.Proceed()
    at Castle.Proxies.IRepository`2Proxy_23.Get(Guid id)

    改成下面就好了

     _schoolInformationRepository.FirstOrDefault(x => x.Id == admin.SchoolId.Value)?.SchoolName;

  • 相关阅读:
    引领5G行业化,广和通荣获“IoT创新大奖”
    Win知识
    物联网通信方式
    萌新配置rip动态路由实验
    FPGA设计经验总结
    UWB定位技术
    REST简介
    linux性能调优总结
    Nginx安装及启动
    leetcode 精选top面试题
  • 原文地址:https://www.cnblogs.com/wangyinlon/p/13260766.html
Copyright © 2011-2022 走看看