Skip to content

Commit

Permalink
Merge branch 'Sync'
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Oct 11, 2023
2 parents f4b6483 + 706ca88 commit d193841
Show file tree
Hide file tree
Showing 46 changed files with 1,304 additions and 955 deletions.
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<EFCoreVersion>8.0.0-rc.1.23419.6</EFCoreVersion>
<MicrosoftExtensionsVersion>8.0.0-rc.1.23419.4</MicrosoftExtensionsVersion>
<NpgsqlVersion>8.0.0-preview.4</NpgsqlVersion>
<EFCoreVersion>8.0.0-rc.2.23480.1</EFCoreVersion>
<MicrosoftExtensionsVersion>8.0.0-rc.2.23479.6</MicrosoftExtensionsVersion>
<NpgsqlVersion>8.0.0-rc.2</NpgsqlVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public NpgsqlNodaTimeMemberTranslator(
|| declaringType == typeof(LocalTime)
|| declaringType == typeof(Period))
{
return TranslateDateTime(instance, member, returnType);
return TranslateDateTime(instance, member);
}

if (declaringType == typeof(ZonedDateTime))
Expand Down Expand Up @@ -281,7 +281,7 @@ SqlExpression Upper()
_dateTypeMapping);
}

private SqlExpression? TranslateDateTime(SqlExpression instance, MemberInfo member, Type returnType)
private SqlExpression? TranslateDateTime(SqlExpression instance, MemberInfo member)
=> member.Name switch
{
"Year" or "Years" => GetDatePartExpression(instance, "year"),
Expand Down Expand Up @@ -378,7 +378,7 @@ private SqlExpression GetDatePartExpressionDouble(

return member == ZonedDateTime_LocalDateTime
? instance
: TranslateDateTime(instance, member, returnType);
: TranslateDateTime(instance, member);
}

// date_part, which is used to extract most components, doesn't have an overload for timestamptz, so passing one directly
Expand All @@ -388,6 +388,6 @@ private SqlExpression GetDatePartExpressionDouble(

return member == ZonedDateTime_LocalDateTime
? instance
: TranslateDateTime(instance, member, returnType);
: TranslateDateTime(instance, member);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new DateIntervalMultirangeMapping(Parameters.WithStoreTypeAndSize(storeType, size), _dateIntervalRangeMapping);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new DateIntervalRangeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.PG.NodaTime/Storage/Internal/DateMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new DateMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new DurationIntervalMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new IntervalMultirangeMapping(Parameters.WithStoreTypeAndSize(storeType, size), _intervalRangeMapping);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new IntervalRangeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new LegacyTimestampInstantMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ static NpgsqlNodaTimeTypeMappingSourcePlugin()
/// </summary>
public NpgsqlNodaTimeTypeMappingSourcePlugin(ISqlGenerationHelper sqlGenerationHelper)
{
_timestampLocalDateTimeRange
= new NpgsqlRangeTypeMapping("tsrange", typeof(NpgsqlRange<LocalDateTime>), _timestampLocalDateTime, sqlGenerationHelper);
_legacyTimestampInstantRange
= new NpgsqlRangeTypeMapping("tsrange", typeof(NpgsqlRange<Instant>), _legacyTimestampInstant, sqlGenerationHelper);
_timestamptzInstantRange
= new NpgsqlRangeTypeMapping("tstzrange", typeof(NpgsqlRange<Instant>), _timestamptzInstant, sqlGenerationHelper);
_timestamptzZonedDateTimeRange
= new NpgsqlRangeTypeMapping("tstzrange", typeof(NpgsqlRange<ZonedDateTime>), _timestamptzZonedDateTime, sqlGenerationHelper);
_timestamptzOffsetDateTimeRange
= new NpgsqlRangeTypeMapping("tstzrange", typeof(NpgsqlRange<OffsetDateTime>), _timestamptzOffsetDateTime, sqlGenerationHelper);
_dateRange
= new NpgsqlRangeTypeMapping("daterange", typeof(NpgsqlRange<LocalDate>), _date, sqlGenerationHelper);
_timestampLocalDateTimeRange = NpgsqlRangeTypeMapping.CreatBuiltInRangeMapping(
"tsrange", typeof(NpgsqlRange<LocalDateTime>), NpgsqlDbType.TimestampRange, _timestampLocalDateTime);
_legacyTimestampInstantRange = NpgsqlRangeTypeMapping.CreatBuiltInRangeMapping(
"tsrange", typeof(NpgsqlRange<Instant>), NpgsqlDbType.TimestampRange, _legacyTimestampInstant);
_timestamptzInstantRange = NpgsqlRangeTypeMapping.CreatBuiltInRangeMapping(
"tstzrange", typeof(NpgsqlRange<Instant>), NpgsqlDbType.TimestampTzRange, _timestamptzInstant);
_timestamptzZonedDateTimeRange = NpgsqlRangeTypeMapping.CreatBuiltInRangeMapping(
"tstzrange", typeof(NpgsqlRange<ZonedDateTime>), NpgsqlDbType.TimestampTzRange, _timestamptzZonedDateTime);
_timestamptzOffsetDateTimeRange = NpgsqlRangeTypeMapping.CreatBuiltInRangeMapping(
"tstzrange", typeof(NpgsqlRange<OffsetDateTime>), NpgsqlDbType.TimestampTzRange, _timestamptzOffsetDateTime);
_dateRange = NpgsqlRangeTypeMapping.CreatBuiltInRangeMapping(
"daterange", typeof(NpgsqlRange<LocalDate>), NpgsqlDbType.DateRange, _date);

var storeTypeMappings = new Dictionary<string, RelationalTypeMapping[]>(StringComparer.OrdinalIgnoreCase)
{
Expand Down Expand Up @@ -192,14 +192,14 @@ public NpgsqlNodaTimeTypeMappingSourcePlugin(ISqlGenerationHelper sqlGenerationH
{
if (clrType is null)
{
return mappings[0].Clone(in mappingInfo);
return mappings[0];
}

foreach (var m in mappings)
{
if (m.ClrType == clrType)
{
return m.Clone(in mappingInfo);
return m;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new PeriodIntervalMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.PG.NodaTime/Storage/Internal/TimeMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new TimeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.PG.NodaTime/Storage/Internal/TimeTzMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new TimeTzMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new TimestampLocalDateTimeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new TimestampTzInstantMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new TimestampTzOffsetDateTimeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override RelationalTypeMapping Clone(string storeType, int? size)
public override RelationalTypeMapping WithStoreTypeAndSize(string storeType, int? size)
=> new TimestampTzZonedDateTimeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
Expand Down
Loading

0 comments on commit d193841

Please sign in to comment.