我有两个表格如下。这些只是示例,我在现实生活中的 table1 要大得多。我的目标是延迟加载 Table1 实体上的 Notes 属性。我已经尝试过 HasOne 映射,但这不起作用。我需要执行哪种 Fluent NHibernate 映射?谢谢
我想延迟加载 notes 属性,因为它并不总是需要的,而且可能会变得很大。
Table1{
Id(int),
Name(string)}
Table1Notes{
Table1Id(int),
Notes(string)
}
最佳答案
mapping.Join( "Table1Notes", map =>
{
map.KeyColumn( "Table1Id" );
map.Map( x => x.Notes ).Nullable().LazyLoad();
map.Optional();
} );
关于c# - 将属性映射到不同的表 Fluent NHibernate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22174335/