开发者

How to improve linq query and remove in clause

I have a linq query

var query = from record in session.Query<Record>()
                           from brwSet in session.Query<BorrowerSet>()
                           from brw in session.Query<Borrower>()
                           where 
                           brw.PrintOrder == 1 && brwSet.PrintOrder == 0
                           && record.Package.BorrowerSet.Contains( brwSet ) 
                           && brwSet.Borrower.Contains( brw )
                           select new Summary()
                           {
                               BorrowerFirstName = brw.Contact.FirstName,
                               BorrowerLastName = brw.Contact.LastName,
                               LoanPackageID = record.Id
                           };
开发者_开发知识库

how could I rewrite this to eliminate the extra from clauses

from brwSet in session.Query<BorrowerSet>()
from brw in session.Query<Borrower>()

how can I rewrite this so I don't need the contains function on these collections?

record.Package.BorrowerSet.Contains( brwSet ) && brwSet.Borrower.Contains( brw )


This query doesn't have Contains.

var query = 
  from record in session.Query<Record>()
  from brwSet in record.Package.BorrowerSet
  where brwSet.PrintOrder == 0
  from brw is brwSet.Borrowers
  where brw.PrintOrder == 1
  select new Summary()
  {
    BorrowerFirstName = brw.Contact.FirstName,
    BorrowerLastName = brw.Contact.LastName,
    LoanPackageID = record.Id
  };
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜