EntityFramework linq查询中的System.NotImplementedException? [英] System.NotImplementedException in EntityFramework linq query?

查看:44
本文介绍了EntityFramework linq查询中的System.NotImplementedException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码:

var query = await _messageGroupRepository.GetAll()
                .Include(x => x.Users)
                .Where(x => x.Users.Any(y => y.Id == 1))
                .OrderByDescending(x => x.Date)
                .Take(5)
                .ToListAsync();

结果: System.NotImplementedException

解决方案?

推荐答案

欢迎使用StackOverflow. NotImplementedException 通常用作尚未实现的方法中的占位符(顾名思义).它很少与生产代码一起出现,而且我认为我从未在成熟的框架或库(如LINQ)中见过它.

Welcome to StackOverflow. The NotImplementedException is typically used as a placeholder in methods which are not yet implemented (as the name suggests). It should rarely occur with production code and I don't think I have ever seen it in a mature framework or library (like LINQ).

在您的情况下,我猜想它是引发异常的存储库中的GetAll()方法(但是您可以检查stacktrace),因为它是那里唯一的非LINQ方法.

In your case, I would guess that it is the GetAll() method on your repository which throws the exception (but you can check the stacktrace), as it is the only non-LINQ method there.

这篇关于EntityFramework linq查询中的System.NotImplementedException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆