Nhibernate 3:检索 nn 关系中的列表

发布于 2024-11-11 18:48:54 字数 432 浏览 9 评论 0原文

我有三个表:工具、颜色和 ColorTool。 ColorTool 有 3 列:id(自动增量)和 IdTool + IdColor。

我有一个 List,我的目标是检索 ListList (只是 IdColor) 。

我的最后一次尝试:

var colorList = (from res in toolList select res.ToolColor.ToList()).ToList();

在这种情况下,colorList 是 ToolColor 列表的列表。

我不知道如何检索该数据。有人可以帮助我吗?我用的是nhibernate 3.1?

问候

I have three tables : Tool, Color and ColorTool.
ColorTool has 3 columns : the id (auto increment) and IdTool + IdColor.

I have a List<Tool> and my goal is to retrieve a List<Color> or a List<int> (just the IdColor).

My last try :

var colorList = (from res in toolList select res.ToolColor.ToList()).ToList();

In this case colorList is a List of List of ToolColor.

I don't know how retrieve that data. Can someone help me ? I use nhibernate 3.1 ?

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自此以后,行同陌路 2024-11-18 18:48:54

怎么样

from res in toolList
from toolColor in res.ToolColor
select toolColor.Color

How about

from res in toolList
from toolColor in res.ToolColor
select toolColor.Color

?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文