首页 > 其他 > 详细

ABP记录被删除调用Repository.Get报错

时间:2020-07-07 15:47:00      阅读:183      评论:0      收藏:0      [点我收藏+]

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

_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;

ABP记录被删除调用Repository.Get报错

原文:https://www.cnblogs.com/wangyinlon/p/13260766.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!