I am testing a bit with having some entities share a common interface. This
interface should make it much easier to write search queries. So just for
fun I tried to add paging.
Criteria API:
var matches = Session
.CreateCriteria<IHaveReference>()
.Add(Restrictions.Eq("Reference", "test"))
.SetFirstResult(3)
.SetMaxResults(3)
.List<IHaveReference>();
Linq API:
var matches = (from r in Session.Query<IHaveReference>()
where r.Reference=="test"
select r)
.Skip(3)
.Take(3);
I did not really expect this to work but the linq api works as expected but
with a warning "firstResult/maxResults specified on polymorphic query;
applying in memory!" which is also what I expected as although you could
make it more efficient but that is probably something that you would want to
do with custom sql queries.
However, the criteria api query does not work as expected. It does the same
paging on all entities and gives weird results.
What should work in this case? If is just an unsupported feature that paging
works via linq?
--
Ramon
--
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.