Skip to content

Commit

Permalink
[add] Changelog
Browse files Browse the repository at this point in the history
[R] Package meta info
[R] Expression body methods
[R] Nullable
  • Loading branch information
i4004 committed Oct 27, 2021
1 parent f26f4d7 commit bcd56ed
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 89 deletions.
11 changes: 11 additions & 0 deletions src/Simplify.FluentNHibernate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## [2.5.1] - 2021-10-27

### Fixed

- MsSQL provider: NRE when UserPassword is null (#310)

### Dependencies

- Switch to Microsoft.Extensions.Configuration.Abstractions 5.0.0 from Microsoft.Extensions.Configuration
40 changes: 20 additions & 20 deletions src/Simplify.FluentNHibernate/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class ConfigurationExtensions
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigOracleClient(this FluentConfiguration fluentConfiguration,
string configSectionName = "DatabaseConnectionSettings",
Action<OracleDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleDataClientConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand All @@ -52,7 +52,7 @@ public static FluentConfiguration InitializeFromConfigOracleClient(this FluentCo
public static FluentConfiguration InitializeFromConfigOracleClient(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
Action<OracleDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleDataClientConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
Expand All @@ -66,7 +66,7 @@ public static FluentConfiguration InitializeFromConfigOracleClient(this FluentCo

private static void InitializeFromConfigOracleClient(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
Action<OracleDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleDataClientConfiguration>? additionalClientConfiguration = null)
{
var clientConfiguration = OracleDataClientConfiguration.Oracle10.ConnectionString(c =>
c.Server(settings.ServerName)
Expand Down Expand Up @@ -96,7 +96,7 @@ private static void InitializeFromConfigOracleClient(FluentConfiguration fluentC
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigOracleOdpNetNative(this FluentConfiguration fluentConfiguration,
string configSectionName = "DatabaseConnectionSettings",
Action<OracleDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleDataClientConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand All @@ -123,7 +123,7 @@ public static FluentConfiguration InitializeFromConfigOracleOdpNetNative(this Fl
public static FluentConfiguration InitializeFromConfigOracleOdpNetNative(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
Action<OracleDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleDataClientConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
Expand All @@ -137,7 +137,7 @@ public static FluentConfiguration InitializeFromConfigOracleOdpNetNative(this Fl

private static void InitializeFromConfigOracleOdpNetNative(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
Action<OracleDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleDataClientConfiguration>? additionalClientConfiguration = null)
{
var clientConfiguration = OracleDataClientConfiguration.Oracle10.ConnectionString(c => c
.Server(settings.ServerName)
Expand Down Expand Up @@ -168,7 +168,7 @@ private static void InitializeFromConfigOracleOdpNetNative(FluentConfiguration f
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigOracleOdpNet(this FluentConfiguration fluentConfiguration,
string configSectionName = "DatabaseConnectionSettings",
Action<OracleManagedDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleManagedDataClientConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand All @@ -195,7 +195,7 @@ public static FluentConfiguration InitializeFromConfigOracleOdpNet(this FluentCo
public static FluentConfiguration InitializeFromConfigOracleOdpNet(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
Action<OracleManagedDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleManagedDataClientConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
Expand All @@ -209,7 +209,7 @@ public static FluentConfiguration InitializeFromConfigOracleOdpNet(this FluentCo

private static void InitializeFromConfigOracleOdpNet(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
Action<OracleManagedDataClientConfiguration> additionalClientConfiguration = null)
Action<OracleManagedDataClientConfiguration>? additionalClientConfiguration = null)
{
var clientConfiguration = OracleManagedDataClientConfiguration.Oracle10.ConnectionString(c => c
.Server(settings.ServerName)
Expand Down Expand Up @@ -240,7 +240,7 @@ private static void InitializeFromConfigOracleOdpNet(FluentConfiguration fluentC
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigMySql(this FluentConfiguration fluentConfiguration,
string configSectionName = "DatabaseConnectionSettings",
Action<MySQLConfiguration> additionalClientConfiguration = null)
Action<MySQLConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand All @@ -267,7 +267,7 @@ public static FluentConfiguration InitializeFromConfigMySql(this FluentConfigura
public static FluentConfiguration InitializeFromConfigMySql(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
Action<MySQLConfiguration> additionalClientConfiguration = null)
Action<MySQLConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
Expand All @@ -281,7 +281,7 @@ public static FluentConfiguration InitializeFromConfigMySql(this FluentConfigura

private static void InitializeFromConfigMySql(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
Action<MySQLConfiguration> additionalClientConfiguration = null)
Action<MySQLConfiguration>? additionalClientConfiguration = null)
{
var clientConfiguration = MySQLConfiguration.Standard.ConnectionString(c => c
.Server(settings.ServerName)
Expand Down Expand Up @@ -310,7 +310,7 @@ private static void InitializeFromConfigMySql(FluentConfiguration fluentConfigur
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigMsSql(this FluentConfiguration fluentConfiguration,
string configSectionName = "DatabaseConnectionSettings",
Action<MsSqlConfiguration> additionalClientConfiguration = null)
Action<MsSqlConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand All @@ -337,7 +337,7 @@ public static FluentConfiguration InitializeFromConfigMsSql(this FluentConfigura
public static FluentConfiguration InitializeFromConfigMsSql(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
Action<MsSqlConfiguration> additionalClientConfiguration = null)
Action<MsSqlConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
Expand All @@ -351,7 +351,7 @@ public static FluentConfiguration InitializeFromConfigMsSql(this FluentConfigura

private static void InitializeFromConfigMsSql(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
Action<MsSqlConfiguration> additionalClientConfiguration = null)
Action<MsSqlConfiguration>? additionalClientConfiguration = null)
{
var clientConfiguration = MsSqlConfiguration.MsSql2008.ConnectionString(c => c
.Server(settings.ServerName)
Expand Down Expand Up @@ -380,7 +380,7 @@ private static void InitializeFromConfigMsSql(FluentConfiguration fluentConfigur
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConfiguration fluentConfiguration,
string configSectionName = "DatabaseConnectionSettings",
Action<PostgreSQLConfiguration> additionalClientConfiguration = null)
Action<PostgreSQLConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand All @@ -407,7 +407,7 @@ public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConf
public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConfiguration fluentConfiguration,
IConfiguration configuration,
string configSectionName = "DatabaseConnectionSettings",
Action<PostgreSQLConfiguration> additionalClientConfiguration = null)
Action<PostgreSQLConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
Expand All @@ -421,7 +421,7 @@ public static FluentConfiguration InitializeFromConfigPostgreSql(this FluentConf

private static void InitializeFromConfigPostgreSql(FluentConfiguration fluentConfiguration,
DbConnectionSettings settings,
Action<PostgreSQLConfiguration> additionalClientConfiguration = null)
Action<PostgreSQLConfiguration>? additionalClientConfiguration = null)
{
var clientConfiguration = PostgreSQLConfiguration.PostgreSQL82.ConnectionString(c => c
.Host(settings.ServerName)
Expand Down Expand Up @@ -457,7 +457,7 @@ private static void InitializeFromConfigPostgreSql(FluentConfiguration fluentCon
public static FluentConfiguration InitializeFromConfigSqLite(this FluentConfiguration fluentConfiguration,
string fileName,
bool showSql = false,
Action<SQLiteConfiguration> additionalClientConfiguration = null)
Action<SQLiteConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));
if (fileName == null) throw new ArgumentNullException(nameof(fileName));
Expand Down Expand Up @@ -487,7 +487,7 @@ public static FluentConfiguration InitializeFromConfigSqLite(this FluentConfigur
/// <exception cref="ArgumentNullException">fluentConfiguration</exception>
public static FluentConfiguration InitializeFromConfigSqLiteInMemory(this FluentConfiguration fluentConfiguration,
bool showSql = false,
Action<SQLiteConfiguration> additionalClientConfiguration = null)
Action<SQLiteConfiguration>? additionalClientConfiguration = null)
{
if (fluentConfiguration == null) throw new ArgumentNullException(nameof(fluentConfiguration));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,35 @@ public class ForeignKeyConstraintNameConvention : IHasManyToManyConvention, IRef
/// Note: 'HasMany' with 'Element' foreign key constraint name is not supported, it should be set manually by 'ForeignKeyConstraintName'
/// </summary>
/// <returns></returns>
public static ForeignKeyConstraintNameConvention WithConstraintNameConvention()
{
return new ForeignKeyConstraintNameConvention();
}
public static ForeignKeyConstraintNameConvention WithConstraintNameConvention() => new ForeignKeyConstraintNameConvention();

/// <summary>
/// Applies the IManyToOneInstance instance.
/// </summary>
/// <param name="instance">The instance.</param>
public void Apply(IManyToOneInstance instance)
{
public void Apply(IManyToOneInstance instance) =>
instance.ForeignKey(
GetForeignConstraintName(
instance.EntityType.Name,
instance.Columns.First().Name));
}

/// <summary>
/// Applies the IManyToManyCollectionInstance instance.
/// </summary>
/// <param name="instance">The instance.</param>
public void Apply(IManyToManyCollectionInstance instance)
{
public void Apply(IManyToManyCollectionInstance instance) =>
instance.Relationship?.ForeignKey(
GetForeignConstraintName(
instance.TableName,
instance.Relationship.Columns.First().Name));
}

/// <summary>
/// Applies the IOneToOneInstance instance.
/// </summary>
/// <param name="instance">The instance.</param>
/// <exception cref="System.NotImplementedException"></exception>
public void Apply(IOneToOneInstance instance)
{
instance.ForeignKey(GetForeignConstraintName(instance.EntityType.Name, instance.Name));
}
public void Apply(IOneToOneInstance instance) => instance.ForeignKey(GetForeignConstraintName(instance.EntityType.Name, instance.Name));

private static string GetForeignConstraintName(string targetTableName, string sourceTableColumnName)
{
return $"FK_{targetTableName}_{sourceTableColumnName}";
}
private static string GetForeignConstraintName(string targetTableName, string sourceTableColumnName) => $"FK_{targetTableName}_{sourceTableColumnName}";
}
}
8 changes: 4 additions & 4 deletions src/Simplify.FluentNHibernate/FluentConfigurationExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void ExportSchema(this FluentConfiguration configuration)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));

Configuration config = null;
Configuration? config = null;
configuration.ExposeConfiguration(c => config = c);
var factory = configuration.BuildSessionFactory();

Expand All @@ -32,15 +32,15 @@ public static void ExportSchema(this FluentConfiguration configuration)
/// <param name="configuration">The configuration.</param>
/// <param name="configurationAddons">The configuration addition setup.</param>
/// <exception cref="ArgumentNullException">configuration</exception>
public static void UpdateSchema(this FluentConfiguration configuration, Action<Configuration> configurationAddons = null)
public static void UpdateSchema(this FluentConfiguration configuration, Action<Configuration>? configurationAddons = null)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));

Configuration config = null;
Configuration? config = null;
configuration.ExposeConfiguration(c => config = c);
configuration.BuildSessionFactory();

configurationAddons?.Invoke(config);
configurationAddons?.Invoke(config!);

var updater = new SchemaUpdate(config);
updater.Execute(true, true);
Expand Down
Loading

0 comments on commit bcd56ed

Please sign in to comment.