2
私はこのようなコードを書く時に、今私は、ORMとしてNHibernateは3.2を使用しています:nhibernateからlinq 3.2へのエラーsqlの生成||オペレータ
PostReaderBll postReaderBll=new PostReaderBll();
var query = from p in postReaderBll.Query()
where (p.Post.Flag == (int)PostType.Post && p.Post.MailState == (int)MailState.Normal) || (p.ReceiveUser == LoginUser.UserIdentity && p.Post.Flag == (int)PostType.Mail && p.Post.MailState == (int)APSP.Form.MailState.Normal)
select p;
私はこのSQLを取得:
SELECT TOP (10 /* @p0 */) ID1_70_,
IsRead2_70_,
ReceiveU3_70_,
ReadDate4_70_,
Flag5_70_,
Label6_70_,
PostID7_70_ FROM (select postreader0_.[ID] as ID1_70_,
postreader0_.[IsRead] as IsRead2_70_,
postreader0_.[ReceiveUser] as ReceiveU3_70_,
postreader0_.[ReadDate] as ReadDate4_70_,
postreader0_.[Flag] as Flag5_70_,
postreader0_.[Label] as Label6_70_,
postreader0_.[PostID] as PostID7_70_, ROW_NUMBER()
OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row
from PostReader postreader0_
inner join Post post1_
on postreader0_.[PostID] = post1_.[ID]
where post1_.[Flag] = 1 /* @p1 */
and post1_.[MailState] = 0 /* @p2 */
or postreader0_.[ReceiveUser] = 'admin' /* @p3 */
and post1_.[Flag] = 0 /* @p4 */
and post1_.[MailState] = 0 /* @p5 */) as query WHERE query.__hibernate_sort_row > 0 /* @p6 */ ORDER BY query.__hibernate_sort_row
をしかし、私はこのような場所が必要です
(post1_.[Flag] = 1 /* @p1 */
and post1_.[MailState] = 0 /* @p2 */)
or (postreader0_.[ReceiveUser] = 'admin' /* @p3 */
and post1_.[Flag] = 0 /* @p4 */
and post1_.[MailState] = 0 /* @p5 */)