HQL“包含"声明如何? [英] HQL "Contains" statement howto?

查看:97
本文介绍了HQL“包含"声明如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实体,该实体具有称为标签"的字符串属性.我想根据某个字符串是否位于标签"属性中来查询该实体.

I have an entity that has a string property called Tags. I would like to query this entity based upon if a certain string is located in Tags property.

例如,我有一个函数IList GetEntityByTag(string tag),它将返回所有在其"Tags"属性中具有tag值的Entity.

So for example, I would have a function IList GetEntityByTag(string tag), this would return all Entity's that have the value of tag in their 'Tags' property.

我尝试过ICriteria方法... Expression.In(PropertyName,Value),但这是完全相反的.我需要像Expression.In(Value,PropertyName)这样的东西.

I tried going through the ICriteria approach... Expression.In(PropertyName, Value) but this is the exact opposite. I need something like Expression.In(Value, PropertyName).

也许IQuery是一种更好的策略,但我无法找到针对属性CONTAINS'abc'的任何HQL语句.

Perhaps IQuery would be a better strategy but I have not been able to find any type of HQL statment for Property CONTAINS 'abc'.

非常感谢任何帮助或指导!

Any help or point of direction would be great thanks!

推荐答案

您的意思是Expression.Like(PropertyName,Value)?

Do you mean Expression.Like(PropertyName, Value)?

这篇关于HQL“包含"声明如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆