So I took this back to the drawing board and figured out how to re-
write my search clause objects to return DetachedCriteria rather than
sql fragments, and then the search provider to assemble these Criteria
and run the search using nothing but the Criteria API.

I'm now looking into how to make these things a little more future-
proof using the QueryOver<T> API.

On Sep 7, 3:37 pm, Dietrich <[email protected]> wrote:
> I was asked to provide a more detailed explanation.
>
> I've got an entity, which may be either a Sample or a Project, and
> that entity has a collection of properties, which could be simply
> thought of as key-value pairs, although they are a bit more complex
> than that.
>
> A sample might have a property "Item" with the value "Item 1", and
> property "Lot" with the value "Lot A".
>
> The users frequently look at lists of these samples or projects, and
> want to filter that list to only samples or projects that have certain
> properties values, or values that match a specific search pattern,
> such as "Ends with A". Additionally, and simultaneously, they may want
> to filter against a value on the Sample or Project table directly. A
> common query in this manner would be "Samples of Item 1 that were
> created since a month ago".
>
> On Aug 22, 8:41 am, Dietrich <[email protected]> wrote:
>
>
>
> > Sorry for the bump, but hoping this was just unseen rather than
> > unknown or a stupid question.
>
> > On Aug 19, 1:11 pm, Dietrich <[email protected]> wrote:
>
> > > I've got some code that takes a list of properties and parameters and
> > > turns them into a SQL statement that returns a list of IDs for objects
> > > that match the search. I need to query over the results of this in a
> > > paged fashion.
>
> > > Currently I use the output of this code like so:
>
> > > .Session.CreateSQLQuery(
> > >                                         @"SELECT {s.*}
> > >                                                 FROM Sample {s}
> > >                                                 INNER JOIN (" + 
> > > filter.BuildSQLStatement() + @") filter
> > >                                                         ON {s}.SampleID = 
> > > filter.ParentID
> > >                                         ORDER BY {s}.SampleID DESC"
> > >                                         ).AddEntity("s", typeof(Sample))
> > >                                         .SetFirstResult((PageNumber - 1) 
> > > * PageSize)
> > >                                         .SetMaxResults(PageSize)
> > >                                         .List<Sample>();
>
> > > I suspect there is a better way to join against this filter- is there?
> > > I'm using NH 3.0 alpha.

-- 
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