如何使属性延迟加载以尊重父/对象在Fluent nHibernate中的批处理?

时间:2014-01-11 15:10:11

标签: c# nhibernate fluent-nhibernate

我有以下地图

public class FilmActorMap : ClassMap<FilmActor>
{
    public FilmActorMap()
    {
        Table("film_actor");
        CompositeId()
            .KeyProperty(x => x.ActorId, "actor_id")
            .KeyProperty(x => x.FilmId, "film_id");
        Map(x => x.LastUpdate, "last_update");
        References<Actor>(x => x.Actor, "actor_id"); //.Fetch.Join();
    }
}

public class ActorMap : ClassMap<Actor>
{
    public ActorMap()
    {
        BatchSize(100);
        Id(x => x.ActorId, "actor_id");
        Map(x => x.FirstName, "first_name");
        Map(x => x.SmallClip, "Clip").LazyLoad();
    }
}

由于我不需要始终加载Actor.Clip,因此我将该属性标记为延迟加载。我是否可以在访问SmallClip时对其进行批处理,就像第一次访问Actor时触发了Actor批处理查询一样?

0 个答案:

没有答案