Skip to content

Commit 1d53f54

Browse files
committed
Commit all source-generated files
See #3979
1 parent bec7386 commit 1d53f54

File tree

58 files changed

+6907
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6907
-3
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+

2+
using System;
3+
4+
using System.Threading;
5+
6+
using System.Threading.Tasks;
7+
8+
using Npgsql.Internal;
9+
10+
using System.Collections.Concurrent;
11+
12+
using System.Collections.ObjectModel;
13+
14+
using GeoJSON.Net;
15+
16+
using GeoJSON.Net.CoordinateReferenceSystem;
17+
18+
using GeoJSON.Net.Geometry;
19+
20+
using Npgsql.BackendMessages;
21+
22+
using Npgsql.Internal.TypeHandling;
23+
24+
using Npgsql.PostgresTypes;
25+
26+
27+
#nullable enable
28+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
29+
#pragma warning disable RS0016 // Add public types and members to the declared API
30+
#pragma warning disable 618 // Member is obsolete
31+
32+
namespace Npgsql.GeoJSON.Internal
33+
{
34+
partial class GeoJsonHandler
35+
{
36+
public override int ValidateObjectAndGetLength(object value, ref NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter)
37+
=> value switch
38+
{
39+
40+
Point converted => ((INpgsqlTypeHandler<Point>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
41+
42+
MultiPoint converted => ((INpgsqlTypeHandler<MultiPoint>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
43+
44+
Polygon converted => ((INpgsqlTypeHandler<Polygon>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
45+
46+
MultiPolygon converted => ((INpgsqlTypeHandler<MultiPolygon>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
47+
48+
LineString converted => ((INpgsqlTypeHandler<LineString>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
49+
50+
MultiLineString converted => ((INpgsqlTypeHandler<MultiLineString>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
51+
52+
GeometryCollection converted => ((INpgsqlTypeHandler<GeometryCollection>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
53+
54+
55+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type GeoJsonHandler")
56+
};
57+
58+
public override Task WriteObjectWithLength(object? value, NpgsqlWriteBuffer buf, NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter, bool async, CancellationToken cancellationToken = default)
59+
=> value switch
60+
{
61+
62+
Point converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
63+
64+
MultiPoint converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
65+
66+
Polygon converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
67+
68+
MultiPolygon converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
69+
70+
LineString converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
71+
72+
MultiLineString converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
73+
74+
GeometryCollection converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
75+
76+
77+
DBNull => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
78+
null => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
79+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type GeoJsonHandler")
80+
};
81+
}
82+
}

src/Npgsql.GeoJSON/Npgsql.GeoJSON.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
<ItemGroup>
2323
<ProjectReference Include="../Npgsql/Npgsql.csproj" />
24+
25+
<!-- TEMPORARY HACK, SEE #3979
2426
<ProjectReference Include="../Npgsql.SourceGenerators/Npgsql.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
25-
</ItemGroup>
27+
-->
28+
</ItemGroup>
2629
</Project>

src/Npgsql.Json.NET/Npgsql.Json.NET.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<PackageTags>npgsql postgresql json postgres ado ado.net database sql</PackageTags>
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net6.0</TargetFramework>
8-
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
9-
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
108
</PropertyGroup>
119

1210
<ItemGroup>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+

2+
using System;
3+
4+
using System.Threading;
5+
6+
using System.Threading.Tasks;
7+
8+
using Npgsql.Internal;
9+
10+
using System.IO;
11+
12+
using NetTopologySuite.Geometries;
13+
14+
using NetTopologySuite.IO;
15+
16+
using Npgsql.BackendMessages;
17+
18+
using Npgsql.Internal.TypeHandling;
19+
20+
using Npgsql.PostgresTypes;
21+
22+
23+
#nullable enable
24+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
25+
#pragma warning disable RS0016 // Add public types and members to the declared API
26+
#pragma warning disable 618 // Member is obsolete
27+
28+
namespace Npgsql.NetTopologySuite.Internal
29+
{
30+
partial class NetTopologySuiteHandler
31+
{
32+
public override int ValidateObjectAndGetLength(object value, ref NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter)
33+
=> value switch
34+
{
35+
36+
Point converted => ((INpgsqlTypeHandler<Point>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
37+
38+
LineString converted => ((INpgsqlTypeHandler<LineString>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
39+
40+
Polygon converted => ((INpgsqlTypeHandler<Polygon>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
41+
42+
MultiPoint converted => ((INpgsqlTypeHandler<MultiPoint>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
43+
44+
MultiLineString converted => ((INpgsqlTypeHandler<MultiLineString>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
45+
46+
MultiPolygon converted => ((INpgsqlTypeHandler<MultiPolygon>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
47+
48+
GeometryCollection converted => ((INpgsqlTypeHandler<GeometryCollection>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
49+
50+
51+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type NetTopologySuiteHandler")
52+
};
53+
54+
public override Task WriteObjectWithLength(object? value, NpgsqlWriteBuffer buf, NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter, bool async, CancellationToken cancellationToken = default)
55+
=> value switch
56+
{
57+
58+
Point converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
59+
60+
LineString converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
61+
62+
Polygon converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
63+
64+
MultiPoint converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
65+
66+
MultiLineString converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
67+
68+
MultiPolygon converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
69+
70+
GeometryCollection converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
71+
72+
73+
DBNull => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
74+
null => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
75+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type NetTopologySuiteHandler")
76+
};
77+
}
78+
}

src/Npgsql.NetTopologySuite/Npgsql.NetTopologySuite.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
<ItemGroup>
2626
<ProjectReference Include="../Npgsql/Npgsql.csproj" />
27+
28+
<!-- TEMPORARY HACK, SEE #3979
2729
<ProjectReference Include="../Npgsql.SourceGenerators/Npgsql.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
30+
-->
2831
</ItemGroup>
2932
</Project>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+

2+
using System;
3+
4+
using System.Threading;
5+
6+
using System.Threading.Tasks;
7+
8+
using Npgsql.Internal;
9+
10+
using NodaTime;
11+
12+
using Npgsql.BackendMessages;
13+
14+
using Npgsql.Internal.TypeHandling;
15+
16+
using Npgsql.PostgresTypes;
17+
18+
using NpgsqlTypes;
19+
20+
21+
#nullable enable
22+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
23+
#pragma warning disable RS0016 // Add public types and members to the declared API
24+
#pragma warning disable 618 // Member is obsolete
25+
26+
namespace Npgsql.NodaTime.Internal
27+
{
28+
partial class DateHandler
29+
{
30+
public override int ValidateObjectAndGetLength(object value, ref NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter)
31+
=> value switch
32+
{
33+
34+
LocalDate converted => ((INpgsqlSimpleTypeHandler<LocalDate>)this).ValidateAndGetLength(converted, parameter),
35+
36+
DateTime converted => ((INpgsqlSimpleTypeHandler<DateTime>)this).ValidateAndGetLength(converted, parameter),
37+
38+
NpgsqlDate converted => ((INpgsqlSimpleTypeHandler<NpgsqlDate>)this).ValidateAndGetLength(converted, parameter),
39+
40+
#if NET6_0_OR_GREATER
41+
DateOnly converted => ((INpgsqlSimpleTypeHandler<DateOnly>)this).ValidateAndGetLength(converted, parameter),
42+
#endif
43+
44+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type DateHandler")
45+
};
46+
47+
public override Task WriteObjectWithLength(object? value, NpgsqlWriteBuffer buf, NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter, bool async, CancellationToken cancellationToken = default)
48+
=> value switch
49+
{
50+
51+
LocalDate converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
52+
53+
DateTime converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
54+
55+
NpgsqlDate converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
56+
57+
#if NET6_0_OR_GREATER
58+
DateOnly converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
59+
#endif
60+
61+
DBNull => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
62+
null => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
63+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type DateHandler")
64+
};
65+
}
66+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+

2+
using System;
3+
4+
using System.Threading;
5+
6+
using System.Threading.Tasks;
7+
8+
using Npgsql.Internal;
9+
10+
using NodaTime;
11+
12+
using Npgsql.BackendMessages;
13+
14+
using Npgsql.Internal.TypeHandlers;
15+
16+
using Npgsql.Internal.TypeHandling;
17+
18+
using Npgsql.PostgresTypes;
19+
20+
using NpgsqlTypes;
21+
22+
23+
#nullable enable
24+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
25+
#pragma warning disable RS0016 // Add public types and members to the declared API
26+
#pragma warning disable 618 // Member is obsolete
27+
28+
namespace Npgsql.NodaTime.Internal
29+
{
30+
partial class DateRangeHandler
31+
{
32+
public override int ValidateObjectAndGetLength(object value, ref NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter)
33+
=> value switch
34+
{
35+
36+
NpgsqlRange<LocalDate> converted => ((INpgsqlTypeHandler<NpgsqlRange<LocalDate>>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
37+
38+
DateInterval converted => ((INpgsqlTypeHandler<DateInterval>)this).ValidateAndGetLength(converted, ref lengthCache, parameter),
39+
40+
41+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type DateRangeHandler")
42+
};
43+
44+
public override Task WriteObjectWithLength(object? value, NpgsqlWriteBuffer buf, NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter, bool async, CancellationToken cancellationToken = default)
45+
=> value switch
46+
{
47+
48+
NpgsqlRange<LocalDate> converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
49+
50+
DateInterval converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
51+
52+
53+
DBNull => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
54+
null => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
55+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type DateRangeHandler")
56+
};
57+
}
58+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+

2+
using System;
3+
4+
using System.Threading;
5+
6+
using System.Threading.Tasks;
7+
8+
using Npgsql.Internal;
9+
10+
using NodaTime;
11+
12+
using Npgsql.BackendMessages;
13+
14+
using Npgsql.Internal.TypeHandling;
15+
16+
using Npgsql.PostgresTypes;
17+
18+
using NpgsqlTypes;
19+
20+
21+
#nullable enable
22+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
23+
#pragma warning disable RS0016 // Add public types and members to the declared API
24+
#pragma warning disable 618 // Member is obsolete
25+
26+
namespace Npgsql.NodaTime.Internal
27+
{
28+
partial class IntervalHandler
29+
{
30+
public override int ValidateObjectAndGetLength(object value, ref NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter)
31+
=> value switch
32+
{
33+
34+
Period converted => ((INpgsqlSimpleTypeHandler<Period>)this).ValidateAndGetLength(converted, parameter),
35+
36+
Duration converted => ((INpgsqlSimpleTypeHandler<Duration>)this).ValidateAndGetLength(converted, parameter),
37+
38+
NpgsqlTimeSpan converted => ((INpgsqlSimpleTypeHandler<NpgsqlTimeSpan>)this).ValidateAndGetLength(converted, parameter),
39+
40+
TimeSpan converted => ((INpgsqlSimpleTypeHandler<TimeSpan>)this).ValidateAndGetLength(converted, parameter),
41+
42+
43+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type IntervalHandler")
44+
};
45+
46+
public override Task WriteObjectWithLength(object? value, NpgsqlWriteBuffer buf, NpgsqlLengthCache? lengthCache, NpgsqlParameter? parameter, bool async, CancellationToken cancellationToken = default)
47+
=> value switch
48+
{
49+
50+
Period converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
51+
52+
Duration converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
53+
54+
NpgsqlTimeSpan converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
55+
56+
TimeSpan converted => WriteWithLength(converted, buf, lengthCache, parameter, async, cancellationToken),
57+
58+
59+
DBNull => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
60+
null => WriteWithLength(DBNull.Value, buf, lengthCache, parameter, async, cancellationToken),
61+
_ => throw new InvalidCastException($"Can't write CLR type {value.GetType()} with handler type IntervalHandler")
62+
};
63+
}
64+
}

0 commit comments

Comments
 (0)