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.
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.
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).
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!
Do you mean Expression.Like(PropertyName, Value)?
If you want to know if a tag is a substring in your Tags property, you might want to consider these tips:
If, as you commented earlier,
If 'a;b;c;d;e' is a string, Expression.ilike( "Tags", "a", MatchMode.ANYWHERE ) will return true.