|
From: Richard B. (JIRA) <nh...@gm...> - 2011-05-17 10:57:54
|
[ http://216.121.112.228/browse/NH-2683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21099#action_21099 ]
Richard Brown commented on NH-2683:
-----------------------------------
Hi Vahid,
I've already started down the road of implementing custom extensions (there's only 1 just now, the rest will follow). You can see an example of its usage at the bottom of the code here: http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs?revision=5829&view=markup
Hopefully you'll agree it's a nice syntax.
For reference, patches should include NH test cases that are self-contained (yours appear to require some kind of data setup?). In addition, the QueryOver tests mostly use unit-tests that compare the output to ICriteria (rather than slower integration tests) - and only use integration tests where necessary.
Cheers,
Richard
> Add common dialect functions as extension methods for QueryOver
> ---------------------------------------------------------------
>
> Key: NH-2683
> URL: http://216.121.112.228/browse/NH-2683
> Project: NHibernate
> Issue Type: Improvement
> Components: QueryOver
> Affects Versions: 3.2.0Alpha2
> Reporter: Richard Brown
> Assignee: Richard Brown
> Priority: Minor
> Attachments: QueryOverSqlFuncsExts.zip
>
>
> Some of the common functions (that are registered in most, if not all Dialects) can be used in ICriteria using SQL-projections.
> Extensions methods can be added for these to allow queries along the lines of:
> s.QueryOver<Person>()
> .Where(p => p.BirthDate.Year() == 1970)
> .List()
> ... which can be translated to:
> .Where(Restrictions.Eq(Projections.SqlFunction("year", NHibernateUtil.DateTime, Projections.Property<Person>(p => p.BirthDate)), 1970))
> ... and in turn to:
> datepart(year, this_.BirthDate) = @p0;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|