Skip to content

Commit 4ec95de

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

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

doc/reference/modules/query_linq.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ 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>
50+
<![CDATA[IList<Cat> whiteKittens =
51+
cat.Kittens.AsQueryable()
52+
.Where(k => k.Color == "white")
53+
.ToList();]]>
54+
</programlisting>
55+
<para>
56+
This will be executed as a query on that <literal>cat</literal>'s kittens without loading the
57+
entire collection.
58+
</para>
59+
<para>&nbsp;</para>
60+
4561
<para>
4662
A client timeout for the query can be defined.
4763
</para>
@@ -789,4 +805,4 @@ cfg.LinqToHqlGeneratorsRegistry<ExtendedLinqToHqlGeneratorsRegistry>();
789805
</para>
790806
</sect2>
791807
</sect1>
792-
</chapter>
808+
</chapter>

0 commit comments

Comments
 (0)