本文介绍了通用存储库模式和复杂的LINQ查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我首先使用通用存储库方法来实现实体框架代码。如果我需要编写复杂的LINQ查询,那么最好的方法是什么?我认为存储库模式的重点是从存储库访问DBContext而不是直接在我的代码中访问。我应该在哪里创建这个复杂的查询?我不认为我应该使用我的存储库之外的上下文,但我想看看别人对这种情况有什么看法。
谢谢
I am using the generic repository approach to entity framework code first. If I need to write a complex LINQ query, what is the best way to do it? I think the whole point to repository pattern is to access the DBContext from the repository and not directly in my code. Where should I create this complex query? I dont think I should be using the context outside my repository, but I want to see what others have to say about this kind of situation.
Thank you
推荐答案
这篇关于通用存储库模式和复杂的LINQ查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!