Skip to content

Commit cf4f23e

Browse files
authored
Code cleanup (#2154)
1 parent a44bca1 commit cf4f23e

File tree

81 files changed

+862
-779
lines changed

Some content is hidden

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

81 files changed

+862
-779
lines changed

.editorconfig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,6 @@ dotnet_naming_rule.const_field_naming.symbols = const_field_symbol
232232
dotnet_naming_rule.const_field_naming.style = pascal_case_style
233233
dotnet_naming_rule.const_field_naming.severity = suggestion
234234

235-
# Private Fields
236-
dotnet_naming_symbols.private_field_symbol.applicable_kinds = field
237-
dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private
238-
239-
dotnet_naming_rule.private_field_naming.symbols = private_field_symbol
240-
dotnet_naming_rule.private_field_naming.style = _camelCase
241-
dotnet_naming_rule.private_field_naming.severity = suggestion
242-
243235
# Parameters
244236
dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
245237
dotnet_naming_symbols.parameter_symbol.applicable_accessibilities = *

EFCore.PG.sln.DotSettings

Lines changed: 137 additions & 5 deletions
Large diffs are not rendered by default.

src/EFCore.PG.NTS/Query/ExpressionTranslators/Internal/NpgsqlNetTopologySuiteMethodCallTranslatorPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ SqlFunctionExpression Function(string name, SqlExpression[] arguments, Type retu
175175
SqlExpression OneBased(SqlExpression arg)
176176
=> arg is SqlConstantExpression constant
177177
? _sqlExpressionFactory.Constant((int)constant.Value! + 1, constant.TypeMapping)
178-
: (SqlExpression)_sqlExpressionFactory.Add(arg, _sqlExpressionFactory.Constant(1));
178+
: _sqlExpressionFactory.Add(arg, _sqlExpressionFactory.Constant(1));
179179

180180
RelationalTypeMapping ResultGeometryMapping()
181181
{

src/EFCore.PG.NTS/Storage/Internal/NpgsqlNetTopologySuiteTypeMappingSourcePlugin.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,19 @@ public static bool TryParseStoreTypeName(
136136
return true;
137137
}
138138

139-
if (subtypeName.EndsWith("ZM", StringComparison.Ordinal) && TryGetClrType(subtypeName[0..^2], out clrType))
139+
if (subtypeName.EndsWith("ZM", StringComparison.Ordinal) && TryGetClrType(subtypeName[..^2], out clrType))
140140
{
141141
ordinates = Ordinates.XYZM;
142142
return true;
143143
}
144144

145-
if (subtypeName.EndsWith("M", StringComparison.Ordinal) && TryGetClrType(subtypeName[0..^1], out clrType))
145+
if (subtypeName.EndsWith("M", StringComparison.Ordinal) && TryGetClrType(subtypeName[..^1], out clrType))
146146
{
147147
ordinates = Ordinates.XYM;
148148
return true;
149149
}
150150

151-
if (subtypeName.EndsWith("Z", StringComparison.Ordinal) && TryGetClrType(subtypeName[0..^1], out clrType))
151+
if (subtypeName.EndsWith("Z", StringComparison.Ordinal) && TryGetClrType(subtypeName[..^1], out clrType))
152152
{
153153
ordinates = Ordinates.XYZ;
154154
return true;

src/EFCore.PG.NodaTime/Storage/Internal/TimeMapping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public override Expression GenerateCodeLiteral(object value)
4242
var time = (LocalTime)value;
4343
return time.NanosecondOfSecond != 0
4444
? ConstantCall(FromHourMinuteSecondNanosecondMethod, time.Hour, time.Minute, time.Second, (long)time.NanosecondOfSecond)
45-
: (Expression)(time.Second != 0
45+
: time.Second != 0
4646
? ConstantNew(ConstructorWithSeconds, time.Hour, time.Minute, time.Second)
47-
: ConstantNew(ConstructorWithMinutes, time.Hour, time.Minute));
47+
: ConstantNew(ConstructorWithMinutes, time.Hour, time.Minute);
4848
}
4949
}

src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private IReadOnlyList<MethodCallCodeFragment> GenerateIdentityOptions(IDictionar
313313
identityOptions.IncrementBy == 1 ? null : (long?) identityOptions.IncrementBy,
314314
identityOptions.MinValue,
315315
identityOptions.MaxValue,
316-
identityOptions.IsCyclic ? true : (bool?) null,
316+
identityOptions.IsCyclic ? true : null,
317317
identityOptions.NumbersToCache == 1 ? null : (long?) identityOptions.NumbersToCache)
318318
};
319319
}

src/EFCore.PG/Diagnostics/NpgsqlEventId.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ReSharper disable once CheckNamespace
12
namespace Microsoft.EntityFrameworkCore.Diagnostics;
23

34
/// <summary>

src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlEntityTypeBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public static EntityTypeBuilder UseCockroachDbInterleaveInParent(
296296
throw new ArgumentException($"Entity not found in model for type: {parentEntity}", nameof(parentTableType));
297297
}
298298

299-
if (StoreObjectIdentifier.Create(parentEntity, StoreObjectType.Table) is not StoreObjectIdentifier tableIdentifier)
299+
if (StoreObjectIdentifier.Create(parentEntity, StoreObjectType.Table) is not { } tableIdentifier)
300300
{
301301
throw new ArgumentException($"Entity {parentEntity.DisplayName()} is not mapped to a database table");
302302
}

src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlModelBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public static ModelBuilder HasPostgresExtension(
284284
public static ModelBuilder HasPostgresExtension(
285285
this ModelBuilder modelBuilder,
286286
string name)
287-
=> modelBuilder.HasPostgresExtension(null, name, null);
287+
=> modelBuilder.HasPostgresExtension(null, name);
288288

289289
#endregion
290290

src/EFCore.PG/Extensions/DbFunctionsExtensions/NpgsqlFullTextSearchDbFunctionsExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
1+
using System.Diagnostics.CodeAnalysis;
22

33
// ReSharper disable once CheckNamespace
44
namespace Microsoft.EntityFrameworkCore;
55

6-
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "UnusedParameter.Global")]
6+
[SuppressMessage("ReSharper", "UnusedParameter.Global")]
77
public static class NpgsqlFullTextSearchDbFunctionsExtensions
88
{
99
/// <summary>

0 commit comments

Comments
 (0)