Login Skip Navigation LinksWilsonORMapper > Forums Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

User Login User Login
Log In
 
 
Reset Password

Wilson ORMapper Forums Wilson ORMapper Forums : General Support : SkipCounts property reset by ObjectSpace?

Date Post
11/16/2006 10:31:24 PM

While doing some tracing, I noticed that WORM was generating 'SELECT COUNT(*) as RecordCount' commands before each query. Stepping through the code, I realized that the SkipCounts property of the relevant instance of the ObjectQuery class was being changed when called by various ObjectSpace methods that take an ObjectQuery parameter.

I'm not sure if this is by design for some reason or not, but I do know that if it isn't by design, the fix is easy -- just change lines that look like this:

ObjectQuery query = new ObjectQuery(objectQuery.ObjectType, objectQuery.WhereClause,
    sortClause, objectQuery.PageSize, objectQuery.PageIndex);

... to this:

ObjectQuery query = new ObjectQuery(objectQuery.ObjectType, objectQuery.WhereClause,
    sortClause, objectQuery.PageSize, objectQuery.PageIndex, objectQuery.SkipCounts);

There's ten or so places in the code that would require the change. Is it safe to do so, or am I opening up Pandora's box in some way that I am not thinking of? It would seem that the above is the right thing to do so the SkipCounts property as set in the initial ObjectQuery should be the "right" property. Without the above change, all Get... commands have SkipCounts set to the default value, false, without regard to what the caller states is appropriate.

 

11/17/2006 9:57:08 AM

I believe you are absolutely correct -- look for this fix in next release (and SP).

Thanks, Paul Wilson

11/25/2006 2:03:38 AM

Thanks, Paul! The more I dig into your product, the more I'm glad I decided to use it in the first place.

In the meantime, for those who bother to read the forums (and everyone does, right?), it's an easy fix -- just search for each instance of a Get..() method in the ObjectSpace.cs that takes an ObjectQuery parameter and make the change.