diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7356fbf9..64eef6f2 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -9,6 +9,7 @@
"indicies",
"langword",
"localizable",
+ "Postgre",
"registrator",
"seealso",
"serializer",
diff --git a/src/Simplify.FluentNHibernate/ConfigurationExtensions.cs b/src/Simplify.FluentNHibernate/ConfigurationExtensions.cs
index 975b6241..50931838 100644
--- a/src/Simplify.FluentNHibernate/ConfigurationExtensions.cs
+++ b/src/Simplify.FluentNHibernate/ConfigurationExtensions.cs
@@ -399,6 +399,7 @@ public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConf
/// The configuration containing database config section.
/// Database configuration section name in configuration.
/// The additional client configuration.
+ /// The dialect.
///
///
/// fluentConfiguration
@@ -408,23 +409,35 @@ public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConf
public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
- Action? additionalClientConfiguration = null)
+ Action? additionalClientConfiguration = null,
+ PostgreSqlDialect dialect = PostgreSqlDialect.PostgreSQL83)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
InitializeFromConfigPostgreSql(fluentConfiguration,
new ConfigurationBasedDbConnectionSettings(configuration, configSectionName),
- additionalClientConfiguration);
+ additionalClientConfiguration,
+ dialect);
return fluentConfiguration;
}
private static void InitializeFromConfigPostgreSql(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
- Action? additionalClientConfiguration = null)
+ Action? additionalClientConfiguration = null,
+ PostgreSqlDialect dialect = PostgreSqlDialect.PostgreSQL83)
{
- var clientConfiguration = PostgreSQLConfiguration.PostgreSQL82.ConnectionString(c => c
+ var clientConfiguration = dialect switch
+ {
+ PostgreSqlDialect.Standard => PostgreSQLConfiguration.Standard,
+ PostgreSqlDialect.PostgreSQL81 => PostgreSQLConfiguration.PostgreSQL81,
+ PostgreSqlDialect.PostgreSQL82 => PostgreSQLConfiguration.PostgreSQL82,
+ PostgreSqlDialect.PostgreSQL83 => PostgreSQLConfiguration.PostgreSQL83,
+ _ => throw new InvalidOperationException()
+ };
+
+ clientConfiguration.ConnectionString(c => c
.Host(settings.ServerName)
.Port(settings.Port ?? 5432)
.Database(settings.DataBaseName)
diff --git a/src/Simplify.FluentNHibernate/PostgreSqlDialect.cs b/src/Simplify.FluentNHibernate/PostgreSqlDialect.cs
new file mode 100644
index 00000000..3f10d8f7
--- /dev/null
+++ b/src/Simplify.FluentNHibernate/PostgreSqlDialect.cs
@@ -0,0 +1,25 @@
+namespace Simplify.FluentNHibernate
+{
+ ///
+ /// Provides PostgreSQL dialect
+ ///
+ public enum PostgreSqlDialect
+ {
+ ///
+ /// The standard dialect
+ ///
+ Standard,
+ ///
+ /// The PostgreSQL 8.1 dialect
+ ///
+ PostgreSQL81,
+ ///
+ /// The PostgreSQL 8.2 dialect
+ ///
+ PostgreSQL82,
+ ///
+ /// The PostgreSQL 8.3 dialect
+ ///
+ PostgreSQL83
+ }
+}
\ No newline at end of file