oursgris
oursgris

Reputation: 2882

Nhibernate 3 : Retrieve a list in a n-n relation

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

Upvotes: 0

Views: 113

Answers (1)

Victor Grigoriu
Victor Grigoriu

Reputation: 479

How about

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

?

Upvotes: 1

Related Questions