Answer the question
In order to leave comments, you need to log in
How to map a one-to-many relationship in Fluent NHibernate when the foreign key is on the "one" side?
Faced the problem of describing a one-to-many relationship with a non-standard table structure. There are 2 tables FOO and BAR which are related as FOO(1)->BAR(*). At the same time, FOO has an ID_BAR column, which points to a set of records from BAR, and BAR has a non-unique CODE column, the value of which is contained in ID_BAR. You need to bind these tables to the appropriate classes:
class Foo
{
public virtual IList<Bar> Bars { get; set; }
}
class Bar
{
public virtual string Code { get; set; }
public virtual Foo Foo { get; set; }
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question