Also, if you're using the trunk, the syntax for UniqueResult recently changed, 
so it's now:

session.QueryOver<obj>()
    ...
    .Select(Projections.RowCount())
    .SingleOrDefault<int>();



From: Richard Brown (gmail) 
Sent: Monday, January 04, 2010 11:22 PM
To: [email protected] 
Subject: Re: [nhusers] Re: How to specify eager loading with the new hql based 
linq provider?


That looks right.  There's always a chance something was missed though - let me 
know if you find something that can be done in ICriteria but not in QueryOver.  
(Sorry Paul, I don't know the answer to the eager-Linq question yet though.)


From: José F. Romaniello 
Sent: Monday, January 04, 2010 10:13 PM
To: [email protected] 
Subject: Re: [nhusers] Re: How to specify eager loading with the new hql based 
linq provider?


something like .SetProjection(Projections.Count(..)).UniqueResult<int>()?




2010/1/4 Paul Batum <[email protected]>

  I tried using QueryOver as a temporary compromise but I couldn't find
  a way to get the count(), which makes it useless for paged search
  results. Did I miss that somehow? 

  And still, I would like to know more about what the plans are for
  eager fetching with the new linq provider.




  On Jan 4, 11:37 pm, Mohamed Meligy <[email protected]> wrote:
  > Yes, Fabio. The last part is not technically correct. I should have said "it
  > comes with the new Linq provider" meaning "with" as "they were found
  > together in the same time almost" not "as part of".
  >
  > The explanation as I mentioned before this:
  > "is a new API that tries to sit in the middle between the old criterion API
  > and the shiny LINQ".
  >
  > Great AP BTW.
  >
  > Regards,
  >
  > --
  > Mohamed Meligy
  > Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
  > Injazat Data Systems
  > P.O. Box: 8230 Abu Dhabi, UAE.
  >
  > Phone:  +971 2 6992700
  > Direct:   +971 2 4045385
  > Mobile:  +971 50 2623624, +971 55 2017 621
  >

  > E-mail: [email protected]

  > Weblog:http://weblogs.asp.net/meligy
  >

  > On Mon, Jan 4, 2010 at 3:30 PM, Fabio Maulo <[email protected]> wrote:
  > > Mohamed, that is not part of the new Linq provider but is a "new"
  > > implementation of Criteria (it sit on top of Criteria but let you work in 
a
  > > more "natural" way).
  >

  > > 2010/1/4 Mohamed Meligy <[email protected]>

  >
  > > This is unfortunately not in the new IQueryable (the one you can access
  > >> through ISession.Query<>() method).
  >
  > >> However, it is available in a new API that tries to sit in the middle
  > >> between the old criterion API and the shiny LINQ. It comes as part of the
  > >> new LINQ provider although it's not LINQ, and tries to simulate LINQ 
syntax.
  > >> Try instead of Query<>() to call the new other method
  > >> ISession.QueryOver<>().
  >
  > >> Sample:
  >
  > >> var query = MySession.QueryOver<ParentEntityType>()
  > >>     .Fetch(x => x.RelatedProperty).Eager
  > >>     .Fetch(x => x.MyOtherProperty).Eager
  > >>     .Where(x => x.Something == someValue)
  > >>     .And(x => x.SomeOthercondition)
  > >>     .OrderBy(orderCriteria).Asc;
  >
  > >> You have nice LINQ-Like methods like Skip() and Take(), as well as a
  > >> List() method for returning multiple results and UniqueResult<>() for
  > >> returning single entity.
  >
  > >> Regards,
  >
  > >> --
  > >> Mohamed Meligy
  > >> Senior Developer, Team Lead Backup (.Net Technologies - TDG -
  > >> Applications)
  > >> Injazat Data Systems
  > >> P.O. Box: 8230 Abu Dhabi, UAE.
  >
  > >> Phone:  +971 2 6992700
  > >> Direct:   +971 2 4045385
  > >> Mobile:  +971 50 2623624, +971 55 2017 621
  >

  > >> E-mail: [email protected]

  > >> Weblog:http://weblogs.asp.net/meligy
  >

  > >> On Mon, Jan 4, 2010 at 10:00 AM, Paul Batum <[email protected]> wrote:
  >
  > >>> The old linq provider had an Expand method that allowed you to specify
  > >>> eager loading, but I can't find the equivalent on the new provider. I
  > >>> have been able to compensate for this in some cases by specifying a
  > >>> join in the linq expression, but this won't work in all cases, such as
  > >>> when you want a collection eagerly loaded. Can someone clarify what
  > >>> the current state of affairs is regarding load options for the new
  > >>> provider and what the plans are?
  >
  > >>> Thanks!
  >
  > >>> Paul Batum
  >
  > >>> --
  >
  > >>> You received this message because you are subscribed to the Google 
Groups
  > >>> "nhusers" group.
  > >>> To post to this group, send email to [email protected].
  > >>> To unsubscribe from this group, send email to

  > >>> 
[email protected]<nhusers%[email protected]>

  > >>> .
  > >>> For more options, visit this group at
  > >>>http://groups.google.com/group/nhusers?hl=en.
  >
  > >>  --
  > >> You received this message because you are subscribed to the Google Groups
  > >> "nhusers" group.
  > >> To post to this group, send email to [email protected].
  > >> To unsubscribe from this group, send email to

  > >> 
[email protected]<nhusers%[email protected]>

  > >> .
  > >> For more options, visit this group at
  > >>http://groups.google.com/group/nhusers?hl=en.
  >
  > > --
  > > Fabio Maulo
  >
  > >  --
  > > You received this message because you are subscribed to the Google Groups
  > > "nhusers" group.
  > > To post to this group, send email to [email protected].
  > > To unsubscribe from this group, send email to

  > > 
[email protected]<nhusers%[email protected]>

  > > .
  > > For more options, visit this group at
  > >http://groups.google.com/group/nhusers?hl=en.

  --

  You received this message because you are subscribed to the Google Groups 
"nhusers" group.
  To post to this group, send email to [email protected].
  To unsubscribe from this group, send email to 
[email protected].
  For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.






--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to