【问题标题】:How to do ThenFetch in Hql and How do you break up many joins in nhibernate linq?如何在 Hql 中执行 ThenFetch 以及如何分解 nhibernate linq 中的许多连接?
【发布时间】:2011-11-16 19:17:48
【问题描述】:

我有 2 个问题

  1. 如何在 hql 中进行 then fetch?

就像在 linq 中一样

var allRecords = session.Query<Table1P>().FetchMany(x => x.Table2).ThenFetchMany(x => x.Table5s);
  1. 当连接过多时如何分解查询。

    var allRecords = session.Query().FetchMany(x => x.Table2).FetchMany(x => x.Table3).FetchMany(x => x.Table4).FetchMany(x => x.Table6 ).ToList();

我怎样才能打破它,使它不会一次完成所有事情?我想急切地加载,但不想一口气加载所有内容。我宁愿尝试打破它。

执行多个单独的查询通常更有效 包含多个连接的单个查询。

http://nhprof.com/Learn/Alerts/TooManyJoins

【问题讨论】:

  • 第 2 点 - 是的,Ayende 是对的。对我来说,这似乎是鸡蛋和鸡肉的问题:你不能两者兼得!代理和延迟加载是否可行?

标签: nhibernate


【解决方案1】:

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 2014-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-10
    • 1970-01-01
    相关资源
    最近更新 更多