Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is an issue with the current implementation of the LINQ extensionmethods for NHibernate 3.1.0.4000 used together with NHibernate Facility 2.0RC (and previous versions) (see: <a href="https://nhibernate.jira.com/browse/NH-2626" rel="nofollow">https://nhibernate.jira.com/browse/NH-2626</a> and discussion here: <a href="http://groups.google.com/group/castle-project-devel/browse_thread/thread/ac90148a8d4c8477" rel="nofollow">http://groups.google.com/group/castle-project-devel/browse_thread/thread/ac90148a8d4c8477</a>)</p> <p>The fix I am using at the moment is to simply ignore the LINQ extensionmethods provided by NHibernate and create it myself. They're really just one-liners:</p> <pre><code>public static class NHibernateLinqExtensions { /// &lt;summary&gt; /// Performs a LINQ query on the specified type. /// &lt;/summary&gt; /// &lt;typeparam name="T"&gt;The type to perform the query on.&lt;/typeparam&gt; /// &lt;param name="session"&gt;&lt;/param&gt; /// &lt;returns&gt;A new &lt;see cref="IQueryable{T}"/&gt;.&lt;/returns&gt; /// &lt;remarks&gt;This method is provided as a workaround for the current bug in the NHibernate LINQ extension methods.&lt;/remarks&gt; public static IQueryable&lt;T&gt; Linq&lt;T&gt;(this ISession session) { return new NhQueryable&lt;T&gt;(session.GetSessionImplementation()); } /// &lt;summary&gt; /// Performs a LINQ query on the specified type. /// &lt;/summary&gt; /// &lt;typeparam name="T"&gt;The type to perform the query on.&lt;/typeparam&gt; /// &lt;param name="session"&gt;&lt;/param&gt; /// &lt;returns&gt;A new &lt;see cref="IQueryable{T}"/&gt;.&lt;/returns&gt; /// &lt;remarks&gt;This method is provided as a workaround for the current bug in the NHibernate LINQ extension methods.&lt;/remarks&gt; public static IQueryable&lt;T&gt; Linq&lt;T&gt;(this IStatelessSession session) { return new NhQueryable&lt;T&gt;(session.GetSessionImplementation()); } } </code></pre> <p>Then, when I need to do a LINQ query, I just use <code>session.Linq&lt;EntityType&gt;()</code> instead of <code>session.Query&lt;EntityType&gt;</code>.</p> <p>Hope it helps someone in the same situation that I was.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload