简体   繁体   English

将属性映射到不同的表Fluent NHibernate

[英]Mapping Property to different table Fluent NHibernate

I have two tables which are below. 我有两张桌子在下面。 These are just examples my table1 in real life is much larger. 这些只是我在现实生活中的表1更大的例子。 What I am aiming to do is lazy load the Notes proerty on the Table1 Entity. 我打算做的是在Table1实体上延迟加载Notes proerty。 I have tried the HasOne mapping but this does not work. 我已经尝试过HasOne映射,但这不起作用。 Which fluent NHibernate mapping do I need to do? 我需要做哪种流畅的NHibernate映射? Thanks 谢谢

I want to lazy load the notes property as it is not always needed and can get quite big. 我想懒得加载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();
} );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM