Re: [nhusers] Is there a query generator for QueryOver like there is for LINQ?

89 views
Skip to first unread message

Richard Brown

unread,
May 15, 2013, 4:03:46 AM5/15/13
to nhu...@googlegroups.com
Hi,

You can register extensions methods, and their ICriterion replacements.  For example, there is a MonthPart() extension to a DateTime:


You create an extension method, and a corresponding implementation that returns an ICriterion (in much the same way as the Linq extensions return an HQL tree):


You can then register this implementation in the QueryOver ExpressionProcessor:


However, I think you'll still need two implementations (i.e., one to form the expression using SQL/ICriteria, and one in in plain old C# code - I'm not sure I can see a way round that for QueryOver.

Does that help?

Cheers,
    Richard




On 1 May 2013 22:33, <adrian....@gmail.com> wrote:

I'm trying to use calculated properties that I use with Query<T>() inside of a QueryOver<T>(). When using a LINQ query, I can register custom generators with a customDefaultLinqToHqlGeneratorsRegistry. This works great for calculated properties from an expression so the code isn't duplicated.

I can't seem to find the extension point for registering custom generators for the QueryOver API. Does it exist?

I'd really like to not have to duplicate the calculated property logic inside of a raw SQL string (Map(x => x.Prop).Formula("query").LazyLoad().Access.ReadOnly()). This means twice the logic and twice the number of tests.

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+u...@googlegroups.com.
To post to this group, send email to nhu...@googlegroups.com.
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages