Skip to content

Commit fc133bf

Browse files
NH-2319 - documenting the feature, to be squashed.
1 parent 9ac4f3c commit fc133bf

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

doc/reference/modules/query_linq.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ using NHibernate.Linq;]]></programlisting>
4242
.Where(c => c.Name == "Max")
4343
.ToList();]]></programlisting>
4444

45+
<para>
46+
Starting with NHibernate 5.0, queries can also be created from an entity collection, with the standard
47+
Linq extension <literal>AsQueryable</literal> available from <literal>System.Linq</literal> namespace.
48+
</para>
49+
<programlisting><![CDATA[IList<Cat> whiteKittens =
50+
cat.Kittens.AsQueryable()
51+
.Where(k => k.Color == "white")
52+
.ToList();]]></programlisting>
53+
<para>
54+
This will be executed as a query on that <literal>cat</literal>'s kittens without loading the
55+
entire collection.
56+
</para>
57+
<para>&nbsp;</para>
58+
4559
<para>
4660
A client timeout for the query can be defined.
4761
</para>
@@ -789,4 +803,4 @@ cfg.LinqToHqlGeneratorsRegistry<ExtendedLinqToHqlGeneratorsRegistry>();
789803
</para>
790804
</sect2>
791805
</sect1>
792-
</chapter>
806+
</chapter>

0 commit comments

Comments
 (0)