私はエンティティとそのマッピングを持っています:
public class Test
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
}
public class TestMap : EntityMap<Test>
{
public TestMap()
{
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Description);
}
}
私はそれに対してクエリを実行しようとしています(データベースから取得するため):
var keyword = "test" // this is coming in from the user
keyword = keyword.ToLower(); // convert it to all lower-case
var results = session.Linq<Test>
.Where(x => x.Name.ToLower().Contains(keyword));
results.Count(); // execute the query
ただし、このクエリを実行するたびに、次の例外が発生します。
Index was out of range. Must be non-negative and less than the size of the
collection. Parameter name: index
現在、Linq to NHibernate は をサポートしていないというのは正しいToLower()
ですか? もしそうなら、Linq to NHibernate と互換性のある別の文字列の途中で文字列を検索できる代替手段はありますか? たとえば、ユーザーが を検索する場合、、、および とkap
一致する必要があります。Kapiolani
Makapuu
Lapkap