开发者

Is it possible to set ExecuteUpdate to respect session filters?

The query below makes use of ExecuteUpdate. I want said method to respect session filters. Is this possible?

//This line seems to make no effect.
_session.EnableFilter(FilterName).SetParameter(FilterParam, Value);


_session.CreateQuery(String.Format("DEL开发者_开发知识库ETE  FROM {0} WHERE Id IN (:idList)", object.Name))
                        .SetParameterList("idList", arrayOfIds)
                        .ExecuteUpdate();

Thanks,


No and the reason is that filters are not domain 'transformers'. They are there just to modify what you want to select. To do what you want you can specify the WHERE class attribute in your mapping although this does not (officially) support parameters


No, it's not possible.

HQL batch update statements are relatively low-level in the NHibernate stack and they will not honor filters.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜