1

NHibernate QueryOver を使用して次のクエリを実行する必要があります。しかし、リストに問題があります。

select * from contact where CountryId = 'xxx' and ContactTypeId in ('aaa', 'bbb')

値は Guid のものです。ContactTypeId (contactTypes) の Guid を含む List() があります。

私は試しましたが、これはうまくいきません:

                var query = contactRepository.GetAllOver()
                    .Where(x => x.Country != null && x.Country.Id == countryId)
                    .WhereRestrictionOn(x => x.ContactType.Id).IsInG(contactTypes);

誰かが QueryOver でこれを書く方法を教えてくれることを願っています。

4

1 に答える 1

2

これを試して

var query = contactRepository.GetAllOver()
                .Where(x => x.Country != null && x.Country.Id == countryId)
                .And(Restrictions.On(c => c.ID).IsIn(contactTypes)

お役に立てば幸いです。

于 2011-04-08T14:12:43.217 に答える