1
votes

Can you map the following scenario with fluent nhibernate, and if so how:

The table structure looks like this:

PrimaryTable
  |__ Intermediary table
        |_
_MyData

"PrimaryTable" -> "Intermediary table" is 1:1 and "Intermediary table" -> MyData is 1:n

The object model looks like this:

PrimaryTableObject
  |__ IList<MyDataObject>

Basically, I want to load the collection but bypass the intermediary table. Is there a way to do this with fluent nhibernate mapping?

Bash me if the question doesn't make sense and I'll edit it with more info.

1

1 Answers

2
votes
class PrimaryMap : ClassMap<Primary>
{
    public PrimaryMap()
    {
        Join("IntermediaryTable", join =>
        {
            join.KeyColumn("primary_id");
            join.HasMany(x => x.MyDataObjects);
        });
    }
}