包括+查找? [英] Include + Find?

查看:98
本文介绍了包括+查找?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在挖掘DbSet上的Find方法(不需要lambda,而且我自动猜测了这些键)。 但是,我发现它不包含加载的关联,并且这样做证明是棘手的。 有没有办法从包含关联的查找中获取
结果?

I'm digging the Find method on DbSet (no need for lambdas and the keys are automagically guessed for me).  However, I'm finding that it does not include loaded associations, and getting it to do so is proving to be tricky.  Is there a way to get results from a Find that include associations loaded?

推荐答案

在此阶段无法使用包含Find的方法。我们在我们的积压工作中看到它(以及许多其他东西),但它不适用于我们的第一个RTM。要使用Include,您需要继续使用以下语法
ctx.Products.Include(p => p.Category).Single(p => p.Id == 4)。

There isn't a way to use include with Find at this stage. We have it on our backlog to look at (along with a lot of other things) but it won't be there for our first RTM. To use Include you will need to continue using the following syntax for the moment ctx.Products.Include(p => p.Category).Single(p => p.Id == 4).

~Rowan


这篇关于包括+查找?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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