2016-06-28 19 views

回答

1

我沒有測試過這下面

select * from table where title like 'AA%' or 'BB%' or 'CC%' 

,但我認爲它是這樣的。

var disjunction = new Disjunction(); 

disjunction.Add(Restrictions.On<YourType>(x => x.Title).IsLike('AA%'); 
disjunction.Add(Restrictions.On<YourType>(x => x.Title).IsLike('BB%'); 
disjunction.Add(Restrictions.On<YourType>(x => x.Title).IsLike('CC%'); 

_session.QueryOver<YourType>().Where(disjunction); 
+0

謝謝。它的工作,但只改變我做,使其工作在我的情況是disjunction.Add(限制。在(x => x.Title).IsInsensitiveLike(item,MatchMode.Start)); –

相關問題