开发者

nHibernate criteria for reversed LIKE

开发者 https://www.devze.com 2023-01-07 04:20 出处:网络
I have the following two entities: public class Entity1 { public IList e2 { get; set; } }开发者_如何学Go

I have the following two entities:

public class Entity1 { public IList e2 { get; set; } }开发者_如何学Go

public class Entity2 { public string Title { get; set; } }

I only have repository for Entity1, I know I can do a LIKE query with the following criteria:

criteria.CreateAlias("e2", "e1e2").Add(Restrictions.LIKE("Title", "needle", Match.Anywhere);

But I need to search the reverse like:

Restrictions.LIKE("needle", "Title", Match.Anywhere)

How can I do it?


I don't think it's available out of the box.

You can either create it using a SQLCriterion, or use HQL.

0

精彩评论

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