Fluent config not generating mapping files

Posted by rboarman on Stack Overflow See other posts from Stack Overflow or by rboarman
Published on 2010-04-08T00:20:05Z Indexed on 2010/04/08 0:23 UTC
Read the original article Hit count: 478

Hello,

I am trying to get Fluent nHibernate to generate mappings so I can take a look at the files and the sql.

My code is based on this post and on what I can glean from the documentation.

http://stackoverflow.com/questions/1375146/fluent-mapping-entities-and-classmaps-in-different-assemblies

I am using the latest code from git.

Here’s my config code:

        Configuration cfg = new Configuration(); 

        var ft = Fluently.Configure(cfg);

        //DbConnection by fluent 
        ft.Database
            (
            MsSqlConfiguration
                .MsSql2008
                .ConnectionString("……")
                .ShowSql()
                .UseReflectionOptimizer()
            );

        //get mapping files. 
        ft.Mappings(m =>
        {
            //set up the mapping locations 
            m.FluentMappings.AddFromAssemblyOf<Entity>()
            .ExportTo(@"C:\temp"); 
            m.Apply(cfg); 
        });

I also tried:

        var sessionFactory = Fluently.Configure()
            .Database(MsSqlConfiguration
                .MsSql2008
                .ShowSql()
                .ConnectionString(“……"))

             .Mappings(p => p.FluentMappings
                .AddFromAssemblyOf<Entity>()
                .ExportTo(@"c:\temp\"))

            .BuildSessionFactory();

I have verified that the connection string is correct.

The issue is that no mapping files show up in the ExportTo folder and no sql code shows up in the output window or in the log file. No errors or exceptions are generated either.

I have no idea where to go from here.

Thank you in advance.

Rick

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about fluent-nhibernate