如何正确加载?

时间:2012-12-10 07:48:21

标签: c# nhibernate fluent-nhibernate

任何人都有任何想法为什么这个查询不会得到正确的加载? (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; }

0 个答案:

没有答案