Search code examples
.netfluent-nhibernatefluent-nhibernate-mapping

can I somehow view FluentNHibernate automappings?


I've got a table I'm not sure is being mapped correctly. I tried looking around the source, but couldn't easily find a way to look at the mappings for a particular entity.

Can someone point me to where those are stored?


Solution

  • If they are automappings and you want to look at what the xml mapping looks like I usually do this by exporting the mappings via xml like so:

    sessionFactory = Fluently.Configure(normalConfig)
                      .Mappings(m =>
                          m.FluentMappings
                          .AddFromAssemblyOf<OrderMap>()
                          .Conventions.AddFromAssemblyOf<PascalCaseColumnNameConvention>()
                          .ExportTo(@"C:\TFS\Fluent Mappings"))
                          .ProxyFactoryFactory("NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate")
                      .BuildSessionFactory();
    

    The important part of course is the: .ExportTo(@"C:\TFS\Fluent Mappings")) above.