开发者

How can I make a query to two different context?

Hi I having some trouble with this situation I have 2 contexts one for employees and the other for Documents my problem is that I want to make a query with this 2 contexts and show only the documents whose E开发者_开发百科mployees_status is diferent to A. Hope your help .


Unless you read all of this data into memory using Linq to Objects there is no way. You need to use a single context that covers the entities of both of those tables to make the query you want.

If you are using a repository pattern, keep in mind that the context represents the unit of work, so it should not be part of each individual repository but sit on top of that (i.e. pass it in as constructor dependency to your repositories).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜