{"id":3692,"date":"2014-03-29T08:02:17","date_gmt":"2014-03-29T08:02:17","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/asp-net-mvc-nhibernate-burrow-fluent-nhibernate-collection-of-common-programming-errors\/"},"modified":"2014-03-29T08:02:17","modified_gmt":"2014-03-29T08:02:17","slug":"asp-net-mvc-nhibernate-burrow-fluent-nhibernate-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/asp-net-mvc-nhibernate-burrow-fluent-nhibernate-collection-of-common-programming-errors\/","title":{"rendered":"ASP.Net MVC &amp; NHibernate Burrow &amp; Fluent NHibernate-Collection of common programming errors"},"content":{"rendered":"<p>To answer why your initial approach failed, <code>cfg.AddMappingsFromAssembly()<\/code> scans the target assembly for preconfigured, embedded XML mapping files built into the assembly. Since you are generating the mappings &#8216;Fluently&#8217; at runtime, these XML files do not exist.<\/p>\n<p>The following, on the other hand, reflects over the assembly to find for your defined &#8216;FluentMappings&#8217; (i.e. those deriving from ClassMap ), generates the mapping dynamically, and injects it into the configuration. The mappings do not exist until you call into <code>FluentMappings.AddFromAssembly()<\/code><\/p>\n<pre><code>Fluently.Configure(cfg)\n    .Mappings(m =&gt; m.FluentMappings.AddFromAssembly(assembly))\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To answer why your initial approach failed, cfg.AddMappingsFromAssembly() scans the target assembly for preconfigured, embedded XML mapping files built into the assembly. Since you are generating the mappings &#8216;Fluently&#8217; at runtime, these XML files do not exist. The following, on the other hand, reflects over the assembly to find for your defined &#8216;FluentMappings&#8217; (i.e. those [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3692","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3692"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3692\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}