Skip to content

Commit

Permalink
Make IDbSetFinder public
Browse files Browse the repository at this point in the history
Fixes #20385

Also annotated internal service properties on public dependency objects.
  • Loading branch information
ajcvickers committed Apr 4, 2020
1 parent 20cd86f commit 37c439e
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public MigrationsScaffolderDependencies(
/// <summary>
/// The operation reporter.
/// </summary>
[EntityFrameworkInternal]
public IOperationReporter OperationReporter { get; }

/// <summary>
Expand All @@ -142,6 +143,7 @@ public MigrationsScaffolderDependencies(
/// <summary>
/// The snapshot model processor.
/// </summary>
[EntityFrameworkInternal]
public ISnapshotModelProcessor SnapshotModelProcessor { get; }

/// <summary>
Expand Down Expand Up @@ -287,6 +289,7 @@ public MigrationsScaffolderDependencies With([NotNull] IHistoryRepository histor
/// </summary>
/// <param name="operationReporter"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public MigrationsScaffolderDependencies With([NotNull] IOperationReporter operationReporter)
=> new MigrationsScaffolderDependencies(
CurrentContext,
Expand Down Expand Up @@ -325,6 +328,7 @@ public MigrationsScaffolderDependencies With([NotNull] IDatabaseProvider databas
/// </summary>
/// <param name="snapshotModelProcessor"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public MigrationsScaffolderDependencies With([NotNull] ISnapshotModelProcessor snapshotModelProcessor)
=> new MigrationsScaffolderDependencies(
CurrentContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public RelationalConnectionDependencies(
/// <summary>
/// A service for resolving a connection string from a name.
/// </summary>
[EntityFrameworkInternal]
public INamedConnectionStringResolver ConnectionStringResolver { get; }

/// <summary>
Expand Down Expand Up @@ -155,6 +156,7 @@ public RelationalConnectionDependencies With([NotNull] IDiagnosticsLogger<DbLogg
/// </summary>
/// <param name="connectionStringResolver"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public RelationalConnectionDependencies With([NotNull] INamedConnectionStringResolver connectionStringResolver)
=> new RelationalConnectionDependencies(
ContextOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public StateManagerDependencies(
/// 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>
[EntityFrameworkInternal]
public IDbSetSource SetSource { get; }

/// <summary>
Expand All @@ -175,6 +176,7 @@ public StateManagerDependencies(
/// 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>
[EntityFrameworkInternal]
public IEntityFinderSource EntityFinderSource { get; }

/// <summary>
Expand Down Expand Up @@ -406,6 +408,7 @@ public StateManagerDependencies With([NotNull] ICurrentDbContext currentContext)
/// </summary>
/// <param name="entityFinderSource"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public StateManagerDependencies With([NotNull] IEntityFinderSource entityFinderSource)
=> new StateManagerDependencies(
InternalEntityEntryFactory,
Expand All @@ -429,6 +432,7 @@ public StateManagerDependencies With([NotNull] IEntityFinderSource entityFinderS
/// </summary>
/// <param name="setSource"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public StateManagerDependencies With([NotNull] IDbSetSource setSource)
=> new StateManagerDependencies(
InternalEntityEntryFactory,
Expand Down
1 change: 0 additions & 1 deletion src/EFCore/Infrastructure/DbSetFinderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Infrastructure
{
Expand Down
30 changes: 30 additions & 0 deletions src/EFCore/Infrastructure/IDbSetFinder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.EntityFrameworkCore.Infrastructure
{
/// <summary>
/// <para>
/// A service for finding <see cref="DbSet{TEntity}" /> properties on a type that inherits from <see cref="DbContext" />.
/// </para>
/// <para>
/// The service lifetime is <see cref="ServiceLifetime.Singleton" />. This means a single instance
/// is used by many <see cref="DbContext" /> instances. The implementation must be thread-safe.
/// This service cannot depend on services registered as <see cref="ServiceLifetime.Scoped" />.
/// </para>
/// </summary>
public interface IDbSetFinder
{
/// <summary>
/// Finds <see cref="DbSet{TEntity}" /> properties on a type that inherits from <see cref="DbContext" />.
/// </summary>
/// <param name="contextType"> A type that inherits from <see cref="DbContext" /> </param>
/// <returns> A list of the found properties. </returns>
IReadOnlyList<DbSetProperty> FindSets([NotNull] Type contextType);
}
}
1 change: 0 additions & 1 deletion src/EFCore/Infrastructure/ModelCustomizerDependencies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Utilities;
using Microsoft.Extensions.DependencyInjection;

Expand Down
2 changes: 2 additions & 0 deletions src/EFCore/Infrastructure/ModelValidatorDependencies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public ModelValidatorDependencies(
/// <summary>
/// The member classifier.
/// </summary>
[EntityFrameworkInternal]
public IMemberClassifier MemberClassifier { get; }

/// <summary>
Expand All @@ -92,6 +93,7 @@ public ModelValidatorDependencies With([NotNull] ITypeMappingSource typeMappingS
/// </summary>
/// <param name="memberClassifier"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public ModelValidatorDependencies With([NotNull] IMemberClassifier memberClassifier)
=> new ModelValidatorDependencies(TypeMappingSource, memberClassifier);
}
Expand Down
1 change: 1 addition & 0 deletions src/EFCore/Internal/DbSetInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.EntityFrameworkCore.Internal
Expand Down
35 changes: 0 additions & 35 deletions src/EFCore/Internal/IDbSetFinder.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Utilities;
Expand Down Expand Up @@ -116,6 +115,7 @@ public ProviderConventionSetBuilderDependencies(
/// <summary>
/// The member classifier.
/// </summary>
[EntityFrameworkInternal]
public IMemberClassifier MemberClassifier { get; }

/// <summary>
Expand Down Expand Up @@ -204,6 +204,7 @@ public ProviderConventionSetBuilderDependencies With([NotNull] IParameterBinding
/// </summary>
/// <param name="memberClassifier"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
[EntityFrameworkInternal]
public ProviderConventionSetBuilderDependencies With([NotNull] IMemberClassifier memberClassifier)
=> new ProviderConventionSetBuilderDependencies(
TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, memberClassifier, Logger, ValidationLogger,
Expand Down

0 comments on commit 37c439e

Please sign in to comment.