linq to nhibernate compareto not supported

前端 未结 3 1704
囚心锁ツ
囚心锁ツ 2020-12-20 08:12

I\'ve got linq to nhibernate query:

var listka = 
    from i in FakturyZakupu.Queryable 
    where String.Compare(i.REJESTRY.REJ_KOD,sbWartoscBetween1.ToStri         


        
3条回答
  •  旧巷少年郎
    2020-12-20 08:40

    With queries like that, you can avoid the compare to by simply using the greater than (>) or less than (<) operators instead of String.Compare. For example:

    var listka =
        from i in FakturyZakupu.Queryable
        where i.REJESTRY.REJ_KOD > sbWartoscBetween1.ToString() &&
        i.REJESTRY.REJ_KOD < sbWartoscBetween2.ToString()
        select i;
    

    Your success with may depend upon your database's interpretation of string comparisons, but should generally work just fine.

提交回复
热议问题