任何人都知道为什么这个查询不能正确加载?(Finan 急切地加载,但 Trans/Charge/Purchaser 没有。
return session.QueryOver<Plot>()
.Where(x => x.Project == Project)
.Fetch(x => x.Trans).Eager
.Fetch(x => x.Charge).Eager
.Fetch(x => x.Finan).Eager
.Fetch(x => x.Purchaser1.User).Eager
.Future<Plot>();
我的映射:
public class PlotMappingOverride : IAutoMappingOverride<Plot>
{
public void Override(AutoMapping<Plot> mapping)
{
mapping.References(x => x.Project).Cascade.SaveUpdate().Not.LazyLoad().Not.Nullable();
mapping.References(x => x.Finan).Cascade.SaveUpdate();
}
}
编辑:我的情节类是这样的:
[Serializable]
public class Plot : BaseEntity<Plot>
{
public virtual Project Project { get; set; }
public virtual string Plot_No { get; set; }
public virtual PlotPurchaser Purchaser1 { get; set; }
public virtual Finan Finan { get; set; }
public virtual Trans Trans{ get; set; }
public virtual Charge Charge{ get; set; }