From: <ric...@us...> - 2011-06-29 21:23:33
|
Revision: 5975 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5975&view=rev Author: ricbrown Date: 2011-06-29 21:23:27 +0000 (Wed, 29 Jun 2011) Log Message: ----------- NH-2683: doc update for QueryOver extensions Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/query_queryover.xml Modified: trunk/nhibernate/doc/reference/modules/query_queryover.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/query_queryover.xml 2011-06-28 05:58:43 UTC (rev 5974) +++ trunk/nhibernate/doc/reference/modules/query_queryover.xml 2011-06-29 21:23:27 UTC (rev 5975) @@ -156,6 +156,16 @@ Restrictions.Where<Cat>(c => c.Age > 5) Restrictions.On<Cat>(c => c.Name).IsIn(new string[] { "Max", "Paddy" })))]]></programlisting> + <para> + However, in addition to the additional restrictions factory methods, there are extension methods to allow + a more concise inline syntax for some of the operators. So this: + </para> + <programlisting><![CDATA[ .WhereRestrictionOn(c => c.Name).IsLike("%anna%")]]></programlisting> + <para> + May also be written as: + </para> + <programlisting><![CDATA[ .Where(c => c..Name.IsLike("%anna%"))]]></programlisting> + </sect1> <sect1 id="queryqueryover-associations"> @@ -322,6 +332,24 @@ </sect1> + <sect1 id="queryqueryover-projectionfunctions"> + <title>Projection Functions</title> + + <para> + In addition to projecting properties, there are extension methods to allow certain common dialect-registered + functions to be applied. For example you can write the following to extract just the year part of a date: + </para> + <programlisting><![CDATA[ .Where(p => p.BirthDate.YearPart() == 1971)]]></programlisting> + + <para> + The functions can also be used inside projections: + </para> + <programlisting><![CDATA[ .Select( + p => Projections.Concat(p.LastName, ", ", p.FirstName), + p => p.Height.Abs())]]></programlisting> + + </sect1> + <sect1 id="queryqueryover-subqueries"> <title>Subqueries</title> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |