Skip to content

Commit fac8485

Browse files
committed
Code cleanup for src
1 parent 29a8c97 commit fac8485

File tree

350 files changed

+2751
-2784
lines changed

Some content is hidden

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

350 files changed

+2751
-2784
lines changed

src/EFCore.Abstractions/EntityTypeConfigurationAttribute.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ public class EntityTypeConfigurationAttribute : Attribute
1919
/// Initializes a new instance of the <see cref="EntityTypeConfigurationAttribute" /> class.
2020
/// </summary>
2121
/// <param name="entityConfigurationType">The IEntityTypeConfiguration&lt;&gt; type to use.</param>
22-
public EntityTypeConfigurationAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.Interfaces)] Type entityConfigurationType)
22+
public EntityTypeConfigurationAttribute(
23+
[DynamicallyAccessedMembers(
24+
DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.Interfaces)]
25+
Type entityConfigurationType)
2326
{
2427
Check.NotNull(entityConfigurationType);
2528

src/EFCore.Analyzers/EFCore.Analyzers.nuspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
23
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
34
<metadata>
45
$CommonMetadataElements$
@@ -14,4 +15,4 @@
1415
<file src="$OutputBinary$" target="analyzers\dotnet\cs\" />
1516
<file src="$OutputSymbol$" target="analyzers\dotnet\cs\" />
1617
</files>
17-
</package>
18+
</package>

src/EFCore.Analyzers/InternalUsageDiagnosticAnalyzer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ private static readonly DiagnosticDescriptor Descriptor
2323
defaultSeverity: DiagnosticSeverity.Warning,
2424
isEnabledByDefault: true);
2525

26-
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => [Descriptor];
26+
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
27+
=> [Descriptor];
2728

2829
public override void Initialize(AnalysisContext context)
2930
{
@@ -308,14 +309,13 @@ private static bool IsInternal(OperationAnalysisContext context, ITypeSymbol sym
308309
&& (IsInInternalNamespace(symbol) || HasInternalAttribute(symbol));
309310

310311
private static bool HasInternalAttribute(ISymbol symbol)
311-
=> symbol.GetAttributes().Any(
312-
a =>
313-
a.AttributeClass!.ToDisplayString()
314-
== "Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternalAttribute");
312+
=> symbol.GetAttributes().Any(a =>
313+
a.AttributeClass!.ToDisplayString()
314+
== "Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternalAttribute");
315315

316316
private static bool IsInInternalNamespace(ISymbol symbol)
317317
{
318-
if (symbol?.ContainingNamespace?.ToDisplayString() is string ns)
318+
if (symbol?.ContainingNamespace?.ToDisplayString() is { } ns)
319319
{
320320
var i = ns.IndexOf("EntityFrameworkCore", StringComparison.Ordinal);
321321

src/EFCore.Analyzers/InterpolatedStringUsageInRawQueriesCodeFixProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace Microsoft.EntityFrameworkCore;
1515
[Shared]
1616
public sealed class InterpolatedStringUsageInRawQueriesCodeFixProvider : CodeFixProvider
1717
{
18-
public override ImmutableArray<string> FixableDiagnosticIds => [EFDiagnostics.InterpolatedStringUsageInRawQueries];
18+
public override ImmutableArray<string> FixableDiagnosticIds
19+
=> [EFDiagnostics.InterpolatedStringUsageInRawQueries];
1920

2021
public override FixAllProvider GetFixAllProvider()
2122
=> WellKnownFixAllProviders.BatchFixer;

src/EFCore.Analyzers/InterpolatedStringUsageInRawQueriesDiagnosticAnalyzer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ private static readonly DiagnosticDescriptor Descriptor
2121
defaultSeverity: DiagnosticSeverity.Warning,
2222
isEnabledByDefault: true);
2323

24-
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => [Descriptor];
24+
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
25+
=> [Descriptor];
2526

2627
public override void Initialize(AnalysisContext context)
2728
{

src/EFCore.Cosmos/ChangeTracking/Internal/StringDictionaryComparer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.ChangeTracking.Internal;
1515
public sealed class StringDictionaryComparer<TDictionary, TElement> : ValueComparer<object>, IInfrastructure<ValueComparer>
1616
{
1717
private static readonly MethodInfo CompareMethod = typeof(StringDictionaryComparer<TDictionary, TElement>).GetMethod(
18-
nameof(Compare), BindingFlags.Static | BindingFlags.NonPublic, [typeof(object), typeof(object), typeof(Func<TElement, TElement, bool>)])!;
18+
nameof(Compare), BindingFlags.Static | BindingFlags.NonPublic,
19+
[typeof(object), typeof(object), typeof(Func<TElement, TElement, bool>)])!;
1920

2021
private static readonly MethodInfo GetHashCodeMethod = typeof(StringDictionaryComparer<TDictionary, TElement>).GetMethod(
2122
nameof(GetHashCode), BindingFlags.Static | BindingFlags.NonPublic, [typeof(IEnumerable), typeof(Func<TElement, int>)])!;
@@ -72,7 +73,7 @@ private static Expression<Func<object, int>> GetHashCodeLambda(ValueComparer ele
7273
Expression.Convert(
7374
prm,
7475
typeof(IEnumerable)),
75-
elementComparer.HashCodeExpression),
76+
elementComparer.HashCodeExpression),
7677
prm);
7778
}
7879

src/EFCore.Cosmos/Diagnostics/Internal/CosmosLoggerExtensions.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,18 @@ private static string ExecutedReadNext(EventDefinitionBase definition, EventData
205205
{
206206
var d = (FallbackEventDefinition)definition;
207207
var p = (CosmosQueryExecutedEventData)payload;
208-
return d.GenerateMessage(
209-
l => l.Log(
210-
d.Level,
211-
d.EventId,
212-
d.MessageFormat,
213-
p.Elapsed.TotalMilliseconds,
214-
p.RequestCharge,
215-
p.ActivityId,
216-
p.ContainerId,
217-
p.LogSensitiveData ? p.PartitionKeyValue.ToString() : "?",
218-
FormatParameters(p.Parameters, p is { LogSensitiveData: true, Parameters.Count: > 0 }),
219-
Environment.NewLine,
220-
p.QuerySql));
208+
return d.GenerateMessage(l => l.Log(
209+
d.Level,
210+
d.EventId,
211+
d.MessageFormat,
212+
p.Elapsed.TotalMilliseconds,
213+
p.RequestCharge,
214+
p.ActivityId,
215+
p.ContainerId,
216+
p.LogSensitiveData ? p.PartitionKeyValue.ToString() : "?",
217+
FormatParameters(p.Parameters, p is { LogSensitiveData: true, Parameters.Count: > 0 }),
218+
Environment.NewLine,
219+
p.QuerySql));
221220
}
222221

223222
/// <summary>

src/EFCore.Cosmos/Extensions/CosmosDbFunctionsExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static double Rrf(this DbFunctions _, params double[] scores)
109109
/// <param name="vector2">The second vector.</param>
110110
/// <param name="useBruteForce">
111111
/// An optional boolean specifying how the computed value is used in an <c>ORDER BY</c> expression.
112-
/// If <see langword="true"/>, then brute force is used. A value of <see langword="false" /> uses any index defined on the vector
112+
/// If <see langword="true" />, then brute force is used. A value of <see langword="false" /> uses any index defined on the vector
113113
/// property, if it exists. Default value is <see langword="false" />.
114114
/// </param>
115115
/// <param name="options">An optional object used to specify options for the vector distance calculation.</param>
@@ -129,7 +129,7 @@ public static double VectorDistance(
129129
/// <param name="vector2">The second vector.</param>
130130
/// <param name="useBruteForce">
131131
/// An optional boolean specifying how the computed value is used in an <c>ORDER BY</c> expression.
132-
/// If <see langword="true"/>, then brute force is used. A value of <see langword="false" /> uses any index defined on the vector
132+
/// If <see langword="true" />, then brute force is used. A value of <see langword="false" /> uses any index defined on the vector
133133
/// property, if it exists. Default value is <see langword="false" />.
134134
/// </param>
135135
/// <param name="options">An optional object used to specify options for the vector distance calculation.</param>
@@ -149,7 +149,7 @@ public static double VectorDistance(
149149
/// <param name="vector2">The second vector.</param>
150150
/// <param name="useBruteForce">
151151
/// An optional boolean specifying how the computed value is used in an <c>ORDER BY</c> expression.
152-
/// If <see langword="true"/>, then brute force is used. A value of <see langword="false" /> uses any index defined on the vector
152+
/// If <see langword="true" />, then brute force is used. A value of <see langword="false" /> uses any index defined on the vector
153153
/// property, if it exists. Default value is <see langword="false" />.
154154
/// </param>
155155
/// <param name="options">An optional object used to specify options for the vector distance calculation.</param>

src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,11 @@ public static bool CanSetThroughput(
10201020
/// <remarks>
10211021
/// See <see href="https://aka.ms/efcore-docs-triggers">Database triggers</see> for more information and examples.
10221022
/// </remarks>
1023-
public static TriggerBuilder HasTrigger(this EntityTypeBuilder entityTypeBuilder, string modelName, TriggerType triggerType, TriggerOperation triggerOperation)
1023+
public static TriggerBuilder HasTrigger(
1024+
this EntityTypeBuilder entityTypeBuilder,
1025+
string modelName,
1026+
TriggerType triggerType,
1027+
TriggerOperation triggerOperation)
10241028
{
10251029
var triggerBuilder = EntityTypeBuilder.HasTrigger(entityTypeBuilder.Metadata, modelName);
10261030
triggerBuilder.Metadata.SetTriggerType(triggerType);
@@ -1039,7 +1043,11 @@ public static TriggerBuilder HasTrigger(this EntityTypeBuilder entityTypeBuilder
10391043
/// <remarks>
10401044
/// See <see href="https://aka.ms/efcore-docs-triggers">Database triggers</see> for more information and examples.
10411045
/// </remarks>
1042-
public static TriggerBuilder HasTrigger<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, string modelName, TriggerType triggerType, TriggerOperation triggerOperation)
1046+
public static TriggerBuilder HasTrigger<TEntity>(
1047+
this EntityTypeBuilder<TEntity> entityTypeBuilder,
1048+
string modelName,
1049+
TriggerType triggerType,
1050+
TriggerOperation triggerOperation)
10431051
where TEntity : class
10441052
{
10451053
var triggerBuilder = EntityTypeBuilder.HasTrigger(entityTypeBuilder.Metadata, modelName);

src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static void SetContainer(this IMutableEntityType entityType, string? name
8080
}
8181

8282
private static string? GetDefaultContainingPropertyName(IReadOnlyEntityType entityType)
83-
=> entityType.FindOwnership() is IReadOnlyForeignKey ownership
83+
=> entityType.FindOwnership() is { } ownership
8484
? ownership.PrincipalToDependent!.Name
8585
: null;
8686

0 commit comments

Comments
 (0)