本文介绍了Fluent NHibernate和PostgreSQL,SchemaMetadataUpdater.QuoteTableAndColumns - System.NotSupportedException:不支持指定的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PostgreSQL的fluentnhibernate。 Fluentnhibernate是最后一个版本。 PosrgreSQL版本是8.4。
创建ISessionFactory的代码:

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

FluentConfiguration配置=流利
.Configure()
.Database(config)
.Mappings(m =>
m.FluentMappings.Add typeof(ResourceMap))
.Add(typeof(TaskMap))
.Add(typeof(PluginMap)));
var nhibConfig = configuration.BuildConfiguration();
SchemaMetadataUpdater.QuoteTableAndColumns(nhibConfig);
返回configuration.BuildSessionFactory();

当我在SchemaMetadataUpdater.QuoteTableAndColumns(nhibConfig)抛出错误:System.NotSupportedException:不支持指定的方法。请帮帮我!我非常需要解决方案。
最好的祝愿

解决方案

试试这个:

<$ p $公共静态ISessionFactory CreateSessionFactory()
{
字符串connectionString = ConfigurationManager.ConnectionStrings [PostgreConnectionString]。ConnectionString;
IPersistenceConfigurer config = PostgreSQLConfiguration.PostgreSQL82.ConnectionString(connectionString);

FluentConfiguration配置=流利
.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));
返回configuration.BuildSessionFactory();
}


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

解决方案

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();
}

这篇关于Fluent NHibernate和PostgreSQL,SchemaMetadataUpdater.QuoteTableAndColumns - System.NotSupportedException:不支持指定的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 14:29