【发布时间】:2011-07-16 00:41:30
【问题描述】:
对于一个 ASP.Net 项目,我使用 (Fluent) NHibernate 来实现持久性,并使用 JQGrid 来在表格中显示数据。但是,当我想使用 JQGrid 的 AutoComplete 功能时,我会在获取 AJAX 请求中的数据时得到一个System.ArgumentException: Column 'HibernateLazyInitializer' does not belong with this table.。
但是这个错误只是偶尔发生,并且在列表中使用了某种代理类时。因此我认为这与 NHibernate 的延迟加载有关。
protected new void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
_jqAutoComplete.DataSource = Session.CreateCriteria<Domain.Brand>()
.List<Domain.Brand>();
_jqAutoComplete.DataBind();
}
通常延迟加载是一个非常酷的功能。只有在这种情况下才会导致错误,因此我不想在整个项目中禁用它。那么,有没有一种方法可以修改 CreateCriteria 以在这种情况下不使用 LazyLoading 而使用 EagerLoading? 还是我还缺少其他东西? 如果有理解 LazyLoading 的好教程,我也会很高兴。
【问题讨论】:
-
您指的是哪个“自动完成”功能以及如何使用它?那是
_jqAutoComplete对象?您是否使用来自trirand.net 的可能商业版本的 jqGrid? -
是的。我用的是商业版的
Trirand.Web.UI.WebControls.JQAutoComplete类。 -
您是否尝试在the trirand.net forum 中发布问题?
-
Nein hab ich noch nicht。 Ich denke, aber dass das ein Problem von meinem NHibernate-Code ist und nicht unbedingt von jqGrid。 Außerdem hab ich nicht das Gefühl, dass ich beim trirand-forum brauchbare Hilfe bekommen könnte.
标签: nhibernate jqgrid lazy-loading jqgrid-asp.net