开发者

Problem using SetFetchMode in NHibernate

开发者 https://www.devze.com 2023-01-02 17:36 出处:网络
i have this method: public IEnumerable<Album> GetAllAlbumsWithTracks() { var albu开发者_Go百科ms = Session.CreateCriteria(typeof(Album))

i have this method:

    public IEnumerable<Album> GetAllAlbumsWithTracks()
    {
        var albu开发者_Go百科ms = Session.CreateCriteria(typeof(Album))
            .SetFetchMode("Tracks", FetchMode.Eager)
            .SetResultTransformer(new DistinctRootEntityResultTransformer()).Future<Album>();

        return albums;
    }

but if i set .SetMaxResult(10) i get back 10 Tracks not Albums. how do i fix this?


try setting the fetch mode to join

0

精彩评论

暂无评论...
验证码 换一张
取 消