c# - ASP MVC : Should services return IQueryable's?

标签 c# asp.net-mvc iqueryable dao

你怎么看?您的 DAO 应该返回一个 IQueryable 以便在您的 Controller 中使用它吗?

最佳答案

没有。您的 Controller 根本不应该处理任何复杂的逻辑。保持 slim ;模型(不是 DAO)应该将 Controller 交还给 View 所需的一切。

在 Controller 类中看到查询(甚至可查询)是我认为是代码味道的东西。

关于c# - ASP MVC : Should services return IQueryable's?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2215057/

相关文章:

c# - Roslyn 是否有内置的 "simplifications"?

c# - 在 ASP.NET MVC 中使用或继承 DisplayAttribute 创建自定义显示属性

jquery - 限制html表格中td标签的字符数

C# 扩展方法类型

.net - IOrderedQueryable 和 IQueryable 有什么区别?

c# - 将字符串解析为 LINQ 查询

c# - 如何将 PictureBox.Image 保存到文件?

c# - 在 Azure 服务总线上调用 Abandon 会将消息重新排队到队列的后面而不是前面

c# - 使用 Interlocked.CompareExchange

asp.net-mvc - 使用 MVC 3.0 与继续使用 .NET 4+ 的长期/短期风险因素?