开发者

Creating an "In" Restriction with Linq to NHibernate

开发者 https://www.devze.com 2023-02-04 17:07 出处:网络
Anybody know how I can create an \"In\" restriction using Linq to NHibernate. i.e. generate SQL like开发者_如何学Python

Anybody know how I can create an "In" restriction using Linq to NHibernate.

i.e. generate SQL like

开发者_如何学Python

select p.Name from Person p where p.City In ('London', 'New York', 'Auckland')

thanks.


OK, I worked this out. Can do:

from p in session.Query<Person> where cities.Contains(p.City) select p

where cities is an array of city names

Anyone know a good reference for Linq to NHibernate examples?

0

精彩评论

暂无评论...
验证码 换一张
取 消