Skip to content

Commit

Permalink
Second pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Sep 23, 2021
1 parent c63d482 commit 4fadf4b
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ public void HandleINotifyCollectionChanged(
break;
case NotifyCollectionChangedAction.Reset:
throw new InvalidOperationException(CoreStrings.ResetNotSupported);
// Note: ignoring Move since index not important
// Note: ignoring Move since index not important
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/EFCore/DbContextOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public override bool Equals(object? obj)
protected virtual bool Equals(DbContextOptions other)
=> _extensionsMap.Count == other._extensionsMap.Count
&& _extensionsMap.Zip(other._extensionsMap)
.All(p => p.First.Value.Ordinal == p.Second.Value.Ordinal
&& p.First.Value.Extension.Info.ShouldUseSameServiceProvider(p.Second.Value.Extension.Info));
.All(
p => p.First.Value.Ordinal == p.Second.Value.Ordinal
&& p.First.Value.Extension.Info.ShouldUseSameServiceProvider(p.Second.Value.Extension.Info));

/// <inheritdoc />
public override int GetHashCode()
Expand Down
3 changes: 1 addition & 2 deletions src/EFCore/DbContextOptions`.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore
Expand Down Expand Up @@ -44,7 +43,7 @@ public DbContextOptions(
}

private DbContextOptions(
ImmutableSortedDictionary<Type, (IDbContextOptionsExtension Extension, int Ordinal)> extensions)
ImmutableSortedDictionary<Type, (IDbContextOptionsExtension Extension, int Ordinal)> extensions)
: base(extensions)
{
}
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3056,8 +3056,8 @@ source.Provider is EntityQueryProvider
/// </exception>
public static IQueryable<T> TagWithCallSite<T>(
this IQueryable<T> source,
[NotParameterized][CallerFilePath] string? filePath = null,
[NotParameterized][CallerLineNumber] int lineNumber = 0)
[NotParameterized] [CallerFilePath] string? filePath = null,
[NotParameterized] [CallerLineNumber] int lineNumber = 0)
{
Check.NotNull(source, nameof(source));

Expand Down
25 changes: 13 additions & 12 deletions src/EFCore/Infrastructure/EntityFrameworkEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public sealed class EntityFrameworkEventSource : EventSource
private PollingCounter? _totalExecutionStrategyOperationFailuresCounter;
private IncrementingPollingCounter? _executionStrategyOperationFailuresPerSecondCounter;
private PollingCounter? _totalOptimisticConcurrencyFailuresCounter;

private IncrementingPollingCounter? _optimisticConcurrencyFailuresPerSecondCounter;
// ReSharper restore NotAccessedField.Local

Expand Down Expand Up @@ -137,13 +138,13 @@ protected override void OnEventCommand(EventCommandEventArgs command)
};

_totalQueriesCounter ??= new PollingCounter("total-queries", this, () => Interlocked.Read(ref _totalQueries))
{ DisplayName = "Queries (Total)" };
{ DisplayName = "Queries (Total)" };

_queriesPerSecondCounter ??= new IncrementingPollingCounter(
"queries-per-second",
this,
() => Interlocked.Read(ref _totalQueries))
{ DisplayName = "Queries", DisplayRateTimeScale = TimeSpan.FromSeconds(1) };
"queries-per-second",
this,
() => Interlocked.Read(ref _totalQueries))
{ DisplayName = "Queries", DisplayRateTimeScale = TimeSpan.FromSeconds(1) };

_totalSaveChangesCounter ??= new PollingCounter("total-save-changes", this, () => Interlocked.Read(ref _totalSaveChanges))
{
Expand All @@ -154,19 +155,19 @@ protected override void OnEventCommand(EventCommandEventArgs command)
"save-changes-per-second",
this,
() => Interlocked.Read(ref _totalSaveChanges))
{ DisplayName = "SaveChanges", DisplayRateTimeScale = TimeSpan.FromSeconds(1) };
{ DisplayName = "SaveChanges", DisplayRateTimeScale = TimeSpan.FromSeconds(1) };

_compiledQueryCacheHitRateCounter ??= new PollingCounter(
"compiled-query-cache-hit-rate",
this,
() => _compiledQueryCacheInfo.CalculateAndReset())
{ DisplayName = "Query Cache Hit Rate", DisplayUnits = "%" };
"compiled-query-cache-hit-rate",
this,
() => _compiledQueryCacheInfo.CalculateAndReset())
{ DisplayName = "Query Cache Hit Rate", DisplayUnits = "%" };

_totalExecutionStrategyOperationFailuresCounter ??= new PollingCounter(
"total-execution-strategy-operation-failures",
this,
() => Interlocked.Read(ref _totalExecutionStrategyOperationFailures))
{ DisplayName = "Execution Strategy Operation Failures (Total)" };
{ DisplayName = "Execution Strategy Operation Failures (Total)" };

_executionStrategyOperationFailuresPerSecondCounter ??= new IncrementingPollingCounter(
"execution-strategy-operation-failures-per-second",
Expand All @@ -181,7 +182,7 @@ protected override void OnEventCommand(EventCommandEventArgs command)
"total-optimistic-concurrency-failures",
this,
() => Interlocked.Read(ref _totalOptimisticConcurrencyFailures))
{ DisplayName = "Optimistic Concurrency Failures (Total)" };
{ DisplayName = "Optimistic Concurrency Failures (Total)" };

_optimisticConcurrencyFailuresPerSecondCounter ??= new IncrementingPollingCounter(
"optimistic-concurrency-failures-per-second",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private IReadOnlyList<RelationshipCandidate> FindRelationshipCandidates(
new RelationshipCandidate(
candidateTargetEntityTypeBuilder, navigations, inverseNavigationCandidates, shouldBeOwnership);

Continue:;
Continue: ;
}

return UpdateTargetEntityTypes(entityTypeBuilder, relationshipCandidates);
Expand Down
21 changes: 11 additions & 10 deletions src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2283,16 +2283,17 @@ private bool CanSetPrincipalKey(
if (configurationSource == ConfigurationSource.Explicit
&& principalEntityTypeBuilder.Metadata.IsKeyless)
{
throw new InvalidOperationException(CoreStrings.PrincipalKeylessType(
principalEntityTypeBuilder.Metadata.DisplayName(),
principalEntityTypeBuilder.Metadata.DisplayName()
+ (navigationToDependent?.Name == null
? ""
: "." + navigationToDependent.Value.Name),
dependentEntityTypeBuilder.Metadata.DisplayName()
+ (navigationToPrincipal?.Name == null
? ""
: "." + navigationToPrincipal.Value.Name)));
throw new InvalidOperationException(
CoreStrings.PrincipalKeylessType(
principalEntityTypeBuilder.Metadata.DisplayName(),
principalEntityTypeBuilder.Metadata.DisplayName()
+ (navigationToDependent?.Name == null
? ""
: "." + navigationToDependent.Value.Name),
dependentEntityTypeBuilder.Metadata.DisplayName()
+ (navigationToPrincipal?.Name == null
? ""
: "." + navigationToPrincipal.Value.Name)));
}

Check.DebugAssert(
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Query/QueryableMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static class QueryableMethods

/// <summary>
/// The <see cref="MethodInfo" /> for
/// <see cref="Queryable.Count{TSource}(IQueryable{TSource},Expression{Func{TSource,bool}})" />
/// <see cref="Queryable.Count{TSource}(IQueryable{TSource},System.Linq.Expressions.Expression{System.Func{TSource,bool}})" />
/// </summary>
public static MethodInfo CountWithPredicate { get; }

Expand Down
2 changes: 1 addition & 1 deletion src/Shared/Check.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static class Check
{
[ContractAnnotation("value:null => halt")]
[return: NotNull]
public static T NotNull<T>([NoEnumeration][AllowNull][NotNull] T value, [InvokerParameterName] string parameterName)
public static T NotNull<T>([NoEnumeration] [AllowNull] [NotNull] T value, [InvokerParameterName] string parameterName)
{
if (value is null)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Shared/Multigraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public IEnumerable<TEdge> GetEdges(TVertex from, TVertex to)
{
if (successorSet.TryGetValue(to, out var edges))
{
return edges is IEnumerable<TEdge> edgeList ? edgeList : (new TEdge[] { (TEdge)edges! });
return edges is IEnumerable<TEdge> edgeList ? edgeList : (new[] { (TEdge)edges! });
}
}

Expand Down Expand Up @@ -63,6 +63,7 @@ public void AddEdge(TVertex from, TVertex to, TEdge edge)
edgeList = new List<TEdge> { (TEdge)edges! };
successorEdges[to] = edgeList;
}

edgeList.Add(edge);
}
else
Expand Down Expand Up @@ -106,6 +107,7 @@ public void AddEdges(TVertex from, TVertex to, IEnumerable<TEdge> newEdges)
edgeList = new List<TEdge> { (TEdge)edges! };
successorEdges[to] = edgeList;
}

edgeList.AddRange(newEdges);
}
else
Expand Down

0 comments on commit 4fadf4b

Please sign in to comment.