This is another issue that I'm working on and, unlike the previous
one, I don't have a solution for it.

The issue is that I have a property on my parent object, User, and the
property is called Logins. Logins represents a collection of Login
information that includes when the user logged in, ip address, etc.
The problem is that the number of login objects gets rather large.
For example, my record count returned is 1333 on our development
database.

Is there a way to limit the number of records returned for this?

The mapping is for this property is as follows:

            HasMany<Login>(x => x.Logins)
                .Table("SystemUserLogin")
                .KeyColumn("UserId")
                .OrderBy("SystemUserLoginId DESC")
                .Inverse()
                .AsBag();

I tried BatchSize, but that caused a really odd SQL query wherein the
WHERE clause was something like:

WHERE logins0_.[UserId] in (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7,
@p8, @p9)

The variables were UserIds and I'm not sure from where it got all of
the IDs.  I'm thinking that an easy way of doing this would be to add
a WHERE() to the mapping and limit the results returned by accessing
the ROW_NUMBER field in the result set, but, at this juncture, we're
still using SQL Server 2000.  I may have to update this when we
upgrade to 2K8 shortly, but I'm not sure whether that would be the
correct thing to do from a design perspective.

-Robert Eberhart

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.

Reply via email to