Question

I have two tables which are below. These are just examples my table1 in real life is much larger. What I am aiming to do is lazy load the Notes proerty on the Table1 Entity. I have tried the HasOne mapping but this does not work. Which fluent NHibernate mapping do I need to do? Thanks

I want to lazy load the notes property as it is not always needed and can get quite big.

Table1{
Id(int),
Name(string)}

Table1Notes{
Table1Id(int),
Notes(string)
}
Was it helpful?

Solution

mapping.Join( "Table1Notes", map =>
{
    map.KeyColumn( "Table1Id" );
    map.Map( x => x.Notes ).Nullable().LazyLoad();
    map.Optional();
} );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top