Skip to content

Commit

Permalink
Sync to 8.0.0-rc.1.23417.21
Browse files Browse the repository at this point in the history
Fixes #2760
Closes #2855
Closes #2641
  • Loading branch information
roji committed Aug 29, 2023
1 parent defe9bc commit e297ffe
Show file tree
Hide file tree
Showing 136 changed files with 2,843 additions and 1,849 deletions.
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<EFCoreVersion>8.0.0-preview.7.23375.4</EFCoreVersion>
<MicrosoftExtensionsVersion>8.0.0-preview.7.23375.6</MicrosoftExtensionsVersion>
<EFCoreVersion>8.0.0-rc.1.23417.21</EFCoreVersion>
<MicrosoftExtensionsVersion>8.0.0-rc.1.23402.2</MicrosoftExtensionsVersion>
<NpgsqlVersion>8.0.0-preview.4</NpgsqlVersion>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions EFCore.PG.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ The .NET Foundation licenses this file to you under the MIT license.&#xD;
<s:Boolean x:Key="/Default/UserDictionary/Words/=Namer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=navigations/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=niladic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ordinality/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=plpgsql/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pluralizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Poolable/@EntryIndexedValue">True</s:Boolean>
Expand Down
34 changes: 3 additions & 31 deletions src/EFCore.PG.NTS/Storage/Internal/NpgsqlGeometryTypeMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,14 @@
// ReSharper disable once CheckNamespace
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 interface INpgsqlGeometryTypeMapping
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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>
RelationalTypeMapping CloneWithElementTypeMapping(RelationalTypeMapping elementTypeMapping);
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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>
[UsedImplicitly]
public class NpgsqlGeometryTypeMapping<TGeometry> : RelationalGeometryTypeMapping<TGeometry, TGeometry>,
INpgsqlTypeMapping, INpgsqlGeometryTypeMapping
public class NpgsqlGeometryTypeMapping<TGeometry> : RelationalGeometryTypeMapping<TGeometry, TGeometry>, INpgsqlTypeMapping
{
private readonly bool _isGeography;

Expand All @@ -47,7 +29,7 @@ public virtual NpgsqlDbType NpgsqlDbType
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public NpgsqlGeometryTypeMapping(string storeType, bool isGeography)
: base(converter: null, NpgsqlJsonGeometryWktReaderWriter.Instance, storeType)
: base(converter: null, storeType, NpgsqlJsonGeometryWktReaderWriter.Instance)
=> _isGeography = isGeography;

/// <summary>
Expand All @@ -68,16 +50,6 @@ protected NpgsqlGeometryTypeMapping(RelationalTypeMappingParameters parameters)
protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters)
=> new NpgsqlGeometryTypeMapping<TGeometry>(parameters);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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>
RelationalTypeMapping INpgsqlGeometryTypeMapping.CloneWithElementTypeMapping(RelationalTypeMapping elementTypeMapping)
=> new NpgsqlGeometryTypeMapping<TGeometry>(
Parameters.WithCoreParameters(Parameters.CoreParameters.WithElementTypeMapping(elementTypeMapping)));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down Expand Up @@ -143,5 +115,5 @@ protected override string GenerateNonNullSqlLiteral(object value)
/// 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>
protected override Type WKTReaderType => typeof(WKTReader);
protected override Type WktReaderType => typeof(WKTReader);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private NpgsqlJsonGeometryWktReaderWriter()
}

/// <inheritdoc />
public override Geometry FromJsonTyped(ref Utf8JsonReaderManager manager)
public override Geometry FromJsonTyped(ref Utf8JsonReaderManager manager, object? existingObject = null)
=> WktReader.Read(manager.CurrentReader.GetString());

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,25 @@ public NpgsqlNetTopologySuiteTypeMappingSourcePlugin(INpgsqlNetTopologySuiteOpti
var typeMapping = (RelationalTypeMapping)Activator.CreateInstance(
typeof(NpgsqlGeometryTypeMapping<>).MakeGenericType(clrType), storeTypeName, isGeography)!;

// TODO: Also restrict the element type mapping based on the user-specified store type?
var elementType = clrType == typeof(MultiPoint)
? typeof(Point)
: clrType == typeof(MultiLineString)
? typeof(LineString)
: clrType == typeof(MultiPolygon)
? typeof(Polygon)
: clrType == typeof(GeometryCollection)
? typeof(Geometry)
: null;

if (elementType is not null)
{
var elementTypeMapping = FindMapping(new() { ClrType = elementType })!;
typeMapping = ((INpgsqlGeometryTypeMapping)typeMapping).CloneWithElementTypeMapping(elementTypeMapping);
}
// TODO: for geometry collection support (and why the following is commented out), see #2850.

// // TODO: Also restrict the element type mapping based on the user-specified store type?
// var elementType = clrType == typeof(MultiPoint)
// ? typeof(Point)
// : clrType == typeof(MultiLineString)
// ? typeof(LineString)
// : clrType == typeof(MultiPolygon)
// ? typeof(Polygon)
// : clrType == typeof(GeometryCollection)
// ? typeof(Geometry)
// : null;
//
// if (elementType is not null)
// {
// var elementTypeMapping = FindMapping(new() { ClrType = elementType })!;
//
// typeMapping = typeMapping.Clone(elementMapping: elementTypeMapping);
// }

return typeMapping;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new DateIntervalMultirangeMapping(Parameters.WithStoreTypeAndSize(storeType, size), _dateIntervalRangeMapping);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new DateIntervalMultirangeMapping(Parameters.WithComposedConverter(converter), _dateIntervalRangeMapping);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new DateIntervalRangeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new DateIntervalRangeMapping(Parameters.WithComposedConverter(converter));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
9 changes: 0 additions & 9 deletions src/EFCore.PG.NodaTime/Storage/Internal/DateMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new DateMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new DateMapping(Parameters.WithComposedConverter(converter));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new DurationIntervalMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new DurationIntervalMapping(Parameters.WithComposedConverter(converter));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new IntervalMultirangeMapping(Parameters.WithStoreTypeAndSize(storeType, size), _intervalRangeMapping);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new IntervalMultirangeMapping(Parameters.WithComposedConverter(converter), _intervalRangeMapping);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new IntervalRangeMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new IntervalRangeMapping(Parameters.WithComposedConverter(converter));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
public override RelationalTypeMapping Clone(string storeType, int? size)
=> new LegacyTimestampInstantMapping(Parameters.WithStoreTypeAndSize(storeType, size));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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 CoreTypeMapping Clone(ValueConverter? converter)
=> new LegacyTimestampInstantMapping(Parameters.WithComposedConverter(converter));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Loading

0 comments on commit e297ffe

Please sign in to comment.