Skip to content

Nuget packages updated #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f968006
Update BitFaster.Caching to version 2.5.3
alex-kulakov Jan 28, 2025
f6f7864
Update Firebird client package to version 10.3.2
alex-kulakov Jan 28, 2025
78ff9d7
Update log4net package to version 3.0.3
alex-kulakov Jan 28, 2025
8eb7842
Update NLog package to version 5.3.4
alex-kulakov Jan 28, 2025
5dbcfde
Update Ms SQL Server client library to version 5.2.2
alex-kulakov Jan 28, 2025
09a4a9d
Update Oracle client library to version 23.7.0
alex-kulakov Jan 28, 2025
6e1ede4
Update MySQL client library to version 8.4.0
alex-kulakov Jan 30, 2025
9a7b5ff
Update Postgresql client library package to version 6.0.13
alex-kulakov Feb 17, 2025
74bc666
SqlExtract: Remove commented code
alex-kulakov Feb 17, 2025
49129f0
Postgre drivers: Add extra provider specific info to driver
alex-kulakov Feb 17, 2025
ac30a98
Paths and Polygon types are fixed now and no longer throw NRE on gett…
alex-kulakov Feb 17, 2025
180425e
Sql level tests for new behavior of Npgsql
alex-kulakov Feb 17, 2025
3b35b2c
Tests for operations over Min/Max values of DateOnly/DateTime/DateTim…
alex-kulakov Feb 17, 2025
b77aa48
Required changes for type mapper for correct reading writing values
alex-kulakov Feb 17, 2025
bbd4a59
PostgreSql connection: access internal property to keep functionality
alex-kulakov Feb 17, 2025
a6e8ed3
Add support for infinity/-infinity replacement within Npgsql
alex-kulakov Feb 17, 2025
446a8a2
Another Npgsql exception detected as operation timeout
alex-kulakov Feb 18, 2025
8ab8c8b
Update Postgresql client library package to version 8.0.6
alex-kulakov Feb 18, 2025
06391a9
Pgsql connection: IsCompleted now can be replace with tx.Connection==…
alex-kulakov Feb 19, 2025
33c22e4
Connection implementations: direct access to activeTransaction property
alex-kulakov Feb 19, 2025
2751df6
Init AppContext switches before any tests
alex-kulakov Feb 20, 2025
9d75199
No explicit tests because of AppContext
alex-kulakov Feb 20, 2025
f0b9e1a
PostgreSQL TypeMapper: assign real Min/Max values instead of server v…
alex-kulakov Feb 24, 2025
8180757
Remove unnecessary parameter SqlNodeCloneContext ctor
alex-kulakov Feb 24, 2025
4fba084
Improved InfinityAliasTests
alex-kulakov Feb 24, 2025
e88b982
Linq Dates operations tests improved
alex-kulakov Feb 24, 2025
8fcc534
PostgreSql: Apply connection timezone to datetimeoffset values on rea…
alex-kulakov Feb 27, 2025
f7edd11
Tests improved
alex-kulakov Feb 27, 2025
b9f3956
StorageProviderVersion extended + TestConfiguration better names
alex-kulakov Feb 27, 2025
57ee1a5
Fixed mismatch of +/-Infinity replacements when part extracted
alex-kulakov Feb 27, 2025
fe73869
Postgre: Native support of reading/binding DateOnly values
alex-kulakov Feb 27, 2025
daffaad
Improved checks for min/max values
alex-kulakov Feb 27, 2025
4d349c3
InfinityAliasTest: Handles extraction non-Year part from infinity value
alex-kulakov Mar 3, 2025
2519969
Postgresql TypeMapper changes
alex-kulakov Mar 3, 2025
b62b2e9
Postgresql compiler changes
alex-kulakov Mar 4, 2025
df67eac
Add IntervalToMilliseconds test
alex-kulakov Mar 4, 2025
aeae65a
Correct fields place
alex-kulakov Mar 4, 2025
2617841
Handle change of result type of Extract in Posgre for TotalMilliseconds
alex-kulakov Mar 6, 2025
540a9c5
Optimize test values
alex-kulakov Mar 6, 2025
b9a1654
PostgreSqlHelper: Change getting timezone
alex-kulakov Apr 21, 2025
a228af6
PostgreSql: TimeZoneInfo as DefaultTimeZone
alex-kulakov Apr 21, 2025
30c151d
Output timezone when test failed
alex-kulakov Apr 22, 2025
b2d70fc
PostgreSqlHelperTest : better split to resolvable and unresolvable zo…
alex-kulakov Apr 22, 2025
80dd482
Improve changelog
alex-kulakov Apr 22, 2025
d6f5159
Merge branch 'master' into master-packages-update
alex-kulakov Apr 22, 2025
770a7c7
Fix error after merge
alex-kulakov Apr 23, 2025
e6b0ee3
Exclude not PostgreSql providers from using MinMaxXXXEntity
alex-kulakov Apr 23, 2025
b9a912b
Temporary revert SQLite client library change
alex-kulakov Apr 24, 2025
1b70d5d
Revert SQLite client package downgrade
alex-kulakov Apr 24, 2025
6c36792
Merge branch 'master' into master-packages-update
alex-kulakov Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion ChangeLog/7.2.0-Beta-2-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@
[main] Obsolete SqlPersistTask constructors removed
[main] Obsolete AggregateProvider constructor removed
[main] Obsolete CalculateProvider constructor removed
[main] Updated BitFaster.Caching to version 2.5.3
[firebird] Updated client library to version 10.3.2
[mysql] SqlDml.NullIf function now correctly translated
[mysql] Improved support for string.PadLeft/PadRight opertaions
[mysql] Updated client library to version 8.4.0
[postgresql] Updated client library to version 8.0.6
[postgresql] Improved .Milliseconds part translation for types that have the part
[postgresql] Improved TimeSpan.TotalMilliseconds translation
[postgresql] AppContext switch "Npgsql.EnableLegacyTimestampBehavior" is turned off if user hasn't set it before Domain build
[postgresql] Both states of "Npgsql.EnableLegacyTimestampBehavior" AppContext switch are supported
[postgresql] AppContext switch "Npgsql.DisableDateTimeInfinityConversions" is turned on if user hasn't set it before Domain build
[postgresql] Supported both states of "Npgsql.DisableDateTimeInfinityConversions" AppContext switch, though "true" is recommended
[postgresql] When infinity conversions are enabled, extra statements will be applied to certain operations to return expected results
[postgresql] DateTime values '0001.01.01 00:00:00.00000' and '9999.12.31 23:59:59.99999' will be read as MinValue and MaxValue accordingly
[postgresql] DateTimeOffset values '0001.01.01 00:00:00.00000+00:00' and '9999.12.31 23:59:59.99999+00:00' will be read as MinValue and MaxValue accordingly
[postgresql] When legacy timestamp behavior is disabled, connection time zone is applied to DateTimeOffset values if possible, otherwise, to local one
[postgresql] TimeSpans based on values lower than -9223372036854775800L and higher 92233720368547758xxL will be read as MinValue and MaxValue accordingly
[oracle] Updated client library to version 23.7.0
[sqlite] Fixed string.Lenght translation
[sqlite] Added support for string.PadLeft/PadRight operations
[sqlite] Added support for string.PadLeft/PadRight operations
[sqlserver] Updated client library to version 5.2.2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="4.5.0" />
<PackageReference Include="NLog" Version="5.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Orm\Xtensive.Orm\Xtensive.Orm.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.10" />
<PackageReference Include="log4net" Version="3.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Orm\Xtensive.Orm\Xtensive.Orm.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Orm/Xtensive.Orm.Firebird/Xtensive.Orm.Firebird.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="8.5.3" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="10.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xtensive.Orm\Xtensive.Orm.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Orm/Xtensive.Orm.MySql/Xtensive.Orm.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MySql.Data" Version="8.0.31" />
<PackageReference Include="MySql.Data" Version="8.4.0" />
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Orm/Xtensive.Orm.Oracle/Xtensive.Orm.Oracle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.18.151" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.7.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xtensive.Orm\Xtensive.Orm.csproj" />
Expand Down
33 changes: 15 additions & 18 deletions Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/Connection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2009-2021 Xtensive LLC.
// Copyright (C) 2009-2025 Xtensive LLC.
// This code is distributed under MIT license terms.
// See the License.txt file in the project root for more information.
// Created by: Denis Krjuchkov
Expand All @@ -10,6 +10,8 @@
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using System.Reflection;
using System;

namespace Xtensive.Sql.Drivers.PostgreSql
{
Expand Down Expand Up @@ -50,14 +52,13 @@ public override void Commit()
{
EnsureIsNotDisposed();
EnsureTransactionIsActive();

try {
if (!IsTransactionCompleted()) {
ActiveTransaction.Commit();
if(!IsTransactionCompleted()) {
activeTransaction.Commit();
}
}
finally {
ActiveTransaction.Dispose();
activeTransaction.Dispose();
ClearActiveTransaction();
}
}
Expand All @@ -68,11 +69,11 @@ public override async Task CommitAsync(CancellationToken token = default)
EnsureTransactionIsActive();
try {
if (!IsTransactionCompleted()) {
await ActiveTransaction.CommitAsync(token).ConfigureAwait(false);
await activeTransaction.CommitAsync(token).ConfigureAwait(false);
}
}
finally {
await ActiveTransaction.DisposeAsync().ConfigureAwait(false);
await activeTransaction.DisposeAsync().ConfigureAwait(false);
ClearActiveTransaction();
}
}
Expand All @@ -81,14 +82,13 @@ public override void Rollback()
{
EnsureIsNotDisposed();
EnsureTransactionIsActive();

try {
if (!IsTransactionCompleted()) {
ActiveTransaction.Rollback();
activeTransaction.Rollback();
}
}
finally {
ActiveTransaction.Dispose();
activeTransaction.Dispose();
ClearActiveTransaction();
}
}
Expand All @@ -99,11 +99,11 @@ public override async Task RollbackAsync(CancellationToken token = default)
EnsureTransactionIsActive();
try {
if (!IsTransactionCompleted()) {
await ActiveTransaction.RollbackAsync(token).ConfigureAwait(false);
await activeTransaction.RollbackAsync(token).ConfigureAwait(false);
}
}
finally {
await ActiveTransaction.DisposeAsync().ConfigureAwait(false);
await activeTransaction.DisposeAsync().ConfigureAwait(false);
ClearActiveTransaction();
}
}
Expand Down Expand Up @@ -169,7 +169,7 @@ private void ExecuteNonQuery(string commandText)
EnsureTransactionIsActive();

using var command = CreateCommand(commandText);
command.ExecuteNonQuery();
_ = command.ExecuteNonQuery();
}

private async Task ExecuteNonQueryAsync(string commandText, CancellationToken token)
Expand All @@ -179,14 +179,11 @@ private async Task ExecuteNonQueryAsync(string commandText, CancellationToken to

var command = CreateCommand(commandText);
await using (command.ConfigureAwait(false)) {
await command.ExecuteNonQueryAsync(token).ConfigureAwait(false);
_ = await command.ExecuteNonQueryAsync(token).ConfigureAwait(false);
}
}

private bool IsTransactionCompleted()
{
return activeTransaction != null && activeTransaction.IsCompleted;
}
private bool IsTransactionCompleted() => activeTransaction.Connection == null;

// Constructors

Expand Down
11 changes: 10 additions & 1 deletion Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ namespace Xtensive.Sql.Drivers.PostgreSql
{
internal abstract class Driver : SqlDriver
{
/// <summary>
/// PosgreSQL-specific information about server.
/// </summary>
internal PostgreServerInfo PostgreServerInfo { get; }

[SecuritySafeCritical]
protected override SqlConnection DoCreateConnection()
{
Expand Down Expand Up @@ -95,14 +100,18 @@ private SqlExceptionType ProcessClientSideException(NpgsqlException clientSideEx
}
}
}
if (innerException is TimeoutException timeoutException) {
return SqlExceptionType.OperationTimeout;
}
return SqlExceptionType.Unknown;
}

// Constructors

protected Driver(CoreServerInfo coreServerInfo)
protected Driver(CoreServerInfo coreServerInfo, PostgreServerInfo pgServerInfo)
: base(coreServerInfo)
{
PostgreServerInfo = pgServerInfo;
}
}
}
94 changes: 80 additions & 14 deletions Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/DriverFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2009-2021 Xtensive LLC.
// Copyright (C) 2009-2025 Xtensive LLC.
// This code is distributed under MIT license terms.
// See the License.txt file in the project root for more information.
// Created by: Denis Krjuchkov
Expand All @@ -23,6 +23,9 @@ public class DriverFactory : SqlDriverFactory
{
private const string DatabaseAndSchemaQuery = "select current_database(), current_schema()";

private readonly static bool InfinityAliasForDatesEnabled;
private readonly static bool LegacyTimestamptBehaviorEnabled;

/// <inheritdoc/>
[SecuritySafeCritical]
protected override string BuildConnectionString(UrlInfo url)
Expand All @@ -44,9 +47,6 @@ protected override string BuildConnectionString(UrlInfo url)
builder.Username = url.User;
builder.Password = url.Password;
}
else {
builder.IntegratedSecurity = true;
}

// custom options
foreach (var param in url.Params) {
Expand All @@ -67,13 +67,18 @@ protected override SqlDriver CreateDriver(string connectionString, SqlDriverConf
OpenConnectionFast(connection, configuration, false).GetAwaiter().GetResult();
var version = GetVersion(configuration, connection);
var defaultSchema = GetDefaultSchema(connection);
return CreateDriverInstance(connectionString, version, defaultSchema);
var defaultTimeZoneInfo = PostgreSqlHelper.GetTimeZoneInfoForServerTimeZone(connection.Timezone);
return CreateDriverInstance(connectionString, version, defaultSchema, defaultTimeZoneInfo);
}

/// <inheritdoc/>
protected override async Task<SqlDriver> CreateDriverAsync(
string connectionString, SqlDriverConfiguration configuration, CancellationToken token)
{
// these settings needed to be read before any connection happens
var useInfinityAliasForDateTime = InfinityAliasForDatesEnabled;
var legacyTimestampBehavior = LegacyTimestamptBehaviorEnabled;

var connection = new NpgsqlConnection(connectionString);
await using (connection.ConfigureAwait(false)) {
if (configuration.DbConnectionAccessors.Count > 0)
Expand All @@ -82,7 +87,8 @@ protected override async Task<SqlDriver> CreateDriverAsync(
await OpenConnectionFast(connection, configuration, true, token).ConfigureAwait(false);
var version = GetVersion(configuration, connection);
var defaultSchema = await GetDefaultSchemaAsync(connection, token: token).ConfigureAwait(false);
return CreateDriverInstance(connectionString, version, defaultSchema);
var defaultTimeZoneInfo = PostgreSqlHelper.GetTimeZoneInfoForServerTimeZone(connection.Timezone);
return CreateDriverInstance(connectionString, version, defaultSchema, defaultTimeZoneInfo);
}
}

Expand All @@ -95,7 +101,8 @@ private static Version GetVersion(SqlDriverConfiguration configuration, NpgsqlCo
}

private static SqlDriver CreateDriverInstance(
string connectionString, Version version, DefaultSchemaInfo defaultSchema)
string connectionString, Version version, DefaultSchemaInfo defaultSchema,
TimeZoneInfo defaultTimeZone)
{
var coreServerInfo = new CoreServerInfo {
ServerVersion = version,
Expand All @@ -105,20 +112,26 @@ private static SqlDriver CreateDriverInstance(
DefaultSchemaName = defaultSchema.Schema,
};

var pgsqlServerInfo = new PostgreServerInfo() {
InfinityAliasForDatesEnabled = InfinityAliasForDatesEnabled,
LegacyTimestampBehavior = LegacyTimestamptBehaviorEnabled,
DefaultTimeZone = defaultTimeZone
};

if (version.Major < 8 || (version.Major == 8 && version.Minor < 3)) {
throw new NotSupportedException(Strings.ExPostgreSqlBelow83IsNotSupported);
}

// We support 8.3, 8.4 and any 9.0+

return version.Major switch {
8 when version.Minor == 3 => new v8_3.Driver(coreServerInfo),
8 when version.Minor > 3 => new v8_4.Driver(coreServerInfo),
9 when version.Minor == 0 => new v9_0.Driver(coreServerInfo),
9 when version.Minor > 0 => new v9_1.Driver(coreServerInfo),
10 => new v10_0.Driver(coreServerInfo),
11 => new v10_0.Driver(coreServerInfo),
_ => new v12_0.Driver(coreServerInfo)
8 when version.Minor == 3 => new v8_3.Driver(coreServerInfo, pgsqlServerInfo),
8 when version.Minor > 3 => new v8_4.Driver(coreServerInfo, pgsqlServerInfo),
9 when version.Minor == 0 => new v9_0.Driver(coreServerInfo, pgsqlServerInfo),
9 when version.Minor > 0 => new v9_1.Driver(coreServerInfo, pgsqlServerInfo),
10 => new v10_0.Driver(coreServerInfo, pgsqlServerInfo),
11 => new v10_0.Driver(coreServerInfo, pgsqlServerInfo),
_ => new v12_0.Driver(coreServerInfo, pgsqlServerInfo)
};
}

Expand Down Expand Up @@ -188,5 +201,58 @@ await SqlHelper.NotifyConnectionInitializingAsync(accessors,
}
}
}

#region Helpers

private static bool SetOrGetExistingDisableInfinityAliasForDatesSwitch(bool valueToSet) =>
GetSwitchValueOrSet(Orm.PostgreSql.WellKnown.DateTimeToInfinityConversionSwitchName, valueToSet);

private static bool SetOrGetExistingLegacyTimeStampBehaviorSwitch(bool valueToSet) =>
GetSwitchValueOrSet(Orm.PostgreSql.WellKnown.LegacyTimestampBehaviorSwitchName, valueToSet);

private static bool GetSwitchValueOrSet(string switchName, bool valueToSet)
{
if (!AppContext.TryGetSwitch(switchName, out var currentValue)) {
AppContext.SetSwitch(switchName, valueToSet);
return valueToSet;
}
else {
return currentValue;
}
}

#endregion

static DriverFactory()
{
// Starging from Npgsql 6.0 they broke compatibility by forcefully replacing
// DateTime.MinValue/MaxValue of parameters with -Infinity and Infinity values.
// This new "feature", though doesn't affect reading/writing of values and equality/inequality
// filters, breaks some of operations such as parts extraction, default values for columns
// (which are constants and declared on high levels of abstraction) and some others.

// We turn it off to make current code work as before and make current data of
// the user be compatible with algorighms as long as possible.
// But if the user sets the switch then we work with what we have.
// Usage of such aliases makes us to create extra statements in SQL queries to provide
// the same results the queries which are already written, which may make queries a bit slower.

// DO NOT REPLACE method call with constant value when debugging, CHANGE THE PARAMETER VALUE.
InfinityAliasForDatesEnabled = !SetOrGetExistingDisableInfinityAliasForDatesSwitch(valueToSet: true);

// Legacy timestamp behavoir turns off certain parameter value binding requirements
// and makes Npgsql work like v4 or older.
// Current behavior require manual specification of unspecified kind for DateTime values,
// because Local or Utc kind now meand that underlying type of value to Timestamp without time zone
// and Timestamp with time zone respectively.
// It also affects DateTimeOffsets, now there is a requirement to move timezone of value to Utc
// this forces us to use only local timezone when reading values, which basically ignores
// Postgre's setting SET TIME ZONE for database session.

// We have to use current mode, not the legacy one, because there is a chance of legacy mode elimination.

// DO NOT REPLACE method call with constant value when debugging, CHANGE THE PARAMETER VALUE.
LegacyTimestamptBehaviorEnabled = SetOrGetExistingLegacyTimeStampBehaviorSwitch(valueToSet: false);
}
}
}
Loading