用于 NHibernate 的 Linq 和预加载的 fetch 模式 [英] Linq for NHibernate and fetch mode of eager loading

查看:16
本文介绍了用于 NHibernate 的 Linq 和预加载的 fetch 模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 linq for nhibernate 将 fetchmode 设置为渴望多个对象.似乎有一种扩展方法,它只允许我设置一个对象.但是我需要为多个对象设置它.这可能吗?谢谢

Is there a way to set the fetchmode to eager for more than one object using linq for nhibernate. There seems to be an expand method which only allows me to set one object. However I need to set it for more than one object. Is this possible? Thanks

推荐答案

多用一次.

IList<Entity> GetDataFromDatabase()
{
    var query = session.Linq<Entity>();
    query.Expand("Property1");
    query.Expand("Property2");
    return query.ToList();
}

这篇关于用于 NHibernate 的 Linq 和预加载的 fetch 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆