开发者

Is it possible to set ExecuteUpdate to respect session filters?

开发者 https://www.devze.com 2023-01-04 18:07 出处:网络
The query below makes use of ExecuteUpdate. I want said method to respect session filters. Is this possible?

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

精彩评论

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

关注公众号