Skip to content

Commit

Permalink
disable default SetSqlTypesKeepDateTime (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
iatsuta authored Sep 14, 2024
1 parent 763c7d8 commit c956a72
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public void Initialize(Configuration cfg)
c.Properties.Add(Environment.LinqToHqlGeneratorsRegistry, typeof(EnhancedLinqToHqlGeneratorsRegistry).AssemblyQualifiedName);
c.Properties.Add(Environment.SqlExceptionConverter, typeof(SQLExceptionConverter).AssemblyQualifiedName);
c.Properties.Add(Environment.CommandTimeout, settings.CommandTimeout.ToString());
c.Properties.Add(Environment.SqlTypesKeepDateTime, settings.SqlTypesKeepDateTime.ToString());
if (settings.SqlTypesKeepDateTime != null)
{
c.Properties.Add(Environment.SqlTypesKeepDateTime, settings.SqlTypesKeepDateTime.ToString());
}
})
.BuildConfiguration();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public record DefaultConfigurationInitializerSettings
{
public int CommandTimeout { get; init; } = 1200;

public bool SqlTypesKeepDateTime { get; init; } = true;
public bool? SqlTypesKeepDateTime { get; init; } = null;

public IsolationLevel? IsolationLevel { get; init; } = null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@

namespace Framework.DomainDriven.NHibernate;

public class NHibSessionSettings : INHibSessionSetup
public class NHibSessionSettings(
IUserAuthenticationService userAuthenticationService,
TimeProvider timeProvider)
: INHibSessionSetup
{

private readonly IUserAuthenticationService userAuthenticationService;


private readonly TimeProvider timeProvider;

public NHibSessionSettings(
IUserAuthenticationService userAuthenticationService,
TimeProvider timeProvider)
{
this.userAuthenticationService = userAuthenticationService ?? throw new ArgumentNullException(nameof(userAuthenticationService));
this.timeProvider = timeProvider ?? throw new ArgumentNullException(nameof(timeProvider));
}

public DBSessionMode DefaultSessionMode { get; } = DBSessionMode.Write;

public AuditPropertyPair GetCreateAuditProperty() => AuditPropertyPair.GetCreateAuditProperty(this.userAuthenticationService, this.timeProvider);
public AuditPropertyPair GetCreateAuditProperty() => AuditPropertyPair.GetCreateAuditProperty(userAuthenticationService, timeProvider);

public AuditPropertyPair GetModifyAuditProperty() => AuditPropertyPair.GetModifyAuditProperty(this.userAuthenticationService, this.timeProvider);
public AuditPropertyPair GetModifyAuditProperty() => AuditPropertyPair.GetModifyAuditProperty(userAuthenticationService, timeProvider);
}
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2009-2024")]

[assembly: AssemblyVersion("22.2.0.0")]
[assembly: AssemblyFileVersion("22.2.0.0")]
[assembly: AssemblyInformationalVersion("22.2.0.0")]
[assembly: AssemblyVersion("22.2.1.0")]
[assembly: AssemblyFileVersion("22.2.1.0")]
[assembly: AssemblyInformationalVersion("22.2.1.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down

0 comments on commit c956a72

Please sign in to comment.