开发者

Remove method using linq

How do I implement the following method (preferably without fetching the items from开发者_Python百科 the database first):

public void Remove(Expression<Func<TEntity, bool>> query)
{
  _session.XXXXXXX
}

It's for my repository class.


I'm afraid that's not currently possible, as Linq in NH is only supported for data-retrieving queries, not updates.

An alternative is using HQL updates: http://nhibernate.info/doc/nh/en/index.html#batch-direct

The end result is the same: HQL queries are type-safe and compiled (by NHibernate)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜