Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluent NHibernate and PostgreSQL, SchemaMetadataUpdater.QuoteTableAndColumns - System.NotSupportedException: Specified method is not supported

I'm using fluentnhibernate with PostgreSQL. Fluentnhibernate is last version. PosrgreSQL version is 8.4. My code for create ISessionFactory:

public static ISessionFactory CreateSessionFactory()
{
        string connectionString = ConfigurationManager.ConnectionStrings["PostgreConnectionString"].ConnectionString;
        IPersistenceConfigurer config = PostgreSQLConfiguration.PostgreSQL82.ConnectionString(connectionString);

        FluentConfiguration configuration = Fluently
            .Configure()
            .Database(config)
            .Mappings(m =>
                m.FluentMappings.Add(typeof(ResourceMap))                                    
                                .Add(typeof(TaskMap))
                                .Add(typeof(PluginMap)));
        var nhibConfig = configuration.BuildConfiguration();
        SchemaMetadataUpdater.QuoteTableAndColumns(nhibConfig);
        return configuration.BuildSessionFactory();
}

When I'm execute code at line SchemaMetadataUpdater.QuoteTableAndColumns(nhibConfig); throw error: System.NotSupportedException: Specified method is not supported. Help me, please! I'm very need for solution. Best regards

like image 985
Vyacheslav Avatar asked Mar 13 '10 13:03

Vyacheslav


1 Answers

Try this:

public static ISessionFactory CreateSessionFactory()
{
        string connectionString = ConfigurationManager.ConnectionStrings["PostgreConnectionString"].ConnectionString;
        IPersistenceConfigurer config = PostgreSQLConfiguration.PostgreSQL82.ConnectionString(connectionString);

        FluentConfiguration configuration = Fluently
            .Configure()
            .Database(config)
            .Mappings(m =>
                m.FluentMappings.Add(typeof(ResourceMap))                                    
                                .Add(typeof(TaskMap))
                                .Add(typeof(PluginMap)));
        configuration.ExposeConfiguration(x => x.SetProperty("hbm2ddl.keywords", "auto-quote"));
        return configuration.BuildSessionFactory();
}
like image 55
Jamie Ide Avatar answered Sep 30 '22 02:09

Jamie Ide