Note that there are some explanatory texts on larger screens.

plurals
  1. POFluent NHibernate FluentMappings.AddFromAssemblyOf<> Issue
    primarykey
    data
    text
    <p>A coworker and I were recently doing the backend for a small application using Fluent NHibernate. We wrote our entities, mapping files, persistence manager, but for some reason we couldn't export the database schema to anything.</p> <p>Through the debugger we discovered that the FluentMappings.AddFromAssemblyOf was returning 0 mappings, even though they are clearly there, and clearly correct. We tried everything we could think of, and ended up having to do add each mapping manually.</p> <p>The following is the code that did not work:</p> <pre><code> return Fluently.Configure().Database( MsSqlConfiguration.MsSql2005 .ConnectionString(c =&gt; c .TrustedConnection() .Server("localhost") .Database("LDTT"))) .Mappings(m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;UserMap&gt;()) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); </code></pre> <p>Whereas this code did work:</p> <pre><code> return Fluently.Configure().Database( MsSqlConfiguration.MsSql2005 .ConnectionString(c =&gt; c .TrustedConnection() .Server("localhost") .Database("LDTT"))) .Mappings(m =&gt; m.FluentMappings.Add&lt;ClientMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;ContactMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;DepartmentMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;DivisionMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;FileMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;FileTypeMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;RegionMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;TimeEntryMap&gt;()) .Mappings(m =&gt; m.FluentMappings.Add&lt;UserMap&gt;()) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); </code></pre> <p>Does anyone know why this happens, and how to fix it?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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