Skip to content

Commit

Permalink
Rename IConventionSetCustomizer to IConventionSetPlugin
Browse files Browse the repository at this point in the history
Part of #15662
  • Loading branch information
ajcvickers committed Jun 21, 2019
1 parent 1c14b58 commit 518fb82
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.EntityFrameworkCore.Proxies.Internal
/// The implementations do not need to be thread-safe.
/// </para>
/// </summary>
public class ProxiesConventionSetCustomizer : IConventionSetCustomizer
public class ProxiesConventionSetPlugin : IConventionSetPlugin
{
private readonly IDbContextOptions _options;
private readonly IProxyFactory _proxyFactory;
Expand All @@ -38,7 +38,7 @@ public class ProxiesConventionSetCustomizer : IConventionSetCustomizer
/// 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>
public ProxiesConventionSetCustomizer(
public ProxiesConventionSetPlugin(
[NotNull] IProxyFactory proxyFactory,
[NotNull] IDbContextOptions options,
[NotNull] LazyLoaderParameterBindingFactoryDependencies lazyLoaderParameterBindingFactoryDependencies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public virtual void Validate(IDbContextOptions options)
using (var scope = internalServiceProvider.CreateScope())
{
if (scope.ServiceProvider
.GetService<IEnumerable<IConventionSetCustomizer>>()
?.Any(s => s is ProxiesConventionSetCustomizer) == false)
.GetService<IEnumerable<IConventionSetPlugin>>()
?.Any(s => s is ProxiesConventionSetPlugin) == false)
{
throw new InvalidOperationException(ProxiesStrings.ProxyServicesMissing);
}
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Proxies/ProxiesServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static IServiceCollection AddEntityFrameworkProxies(
Check.NotNull(serviceCollection, nameof(serviceCollection));

new EntityFrameworkServicesBuilder(serviceCollection)
.TryAdd<IConventionSetCustomizer, ProxiesConventionSetCustomizer>()
.TryAdd<IConventionSetPlugin, ProxiesConventionSetPlugin>()
.TryAddProviderSpecificServices(
b => b.TryAddSingleton<IProxyFactory, ProxyFactory>());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure
/// <summary>
/// <para>
/// A service on the EF internal service provider that creates the <see cref="ConventionSet" />
/// for the current relational database provider. This is combined with <see cref="IConventionSetCustomizer" />
/// for the current relational database provider. This is combined with <see cref="IConventionSetPlugin" />
/// instances to produce the full convention set exposed by the <see cref="IConventionSetBuilder" />
/// service.
/// </para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static readonly IDictionary<Type, ServiceCharacteristics> CoreServices
{ typeof(IParameterBindingFactory), new ServiceCharacteristics(ServiceLifetime.Singleton, multipleRegistrations: true) },
{ typeof(ITypeMappingSourcePlugin), new ServiceCharacteristics(ServiceLifetime.Singleton, multipleRegistrations: true) },
{ typeof(ISingletonOptions), new ServiceCharacteristics(ServiceLifetime.Singleton, multipleRegistrations: true) },
{ typeof(IConventionSetCustomizer), new ServiceCharacteristics(ServiceLifetime.Scoped, multipleRegistrations: true) },
{ typeof(IConventionSetPlugin), new ServiceCharacteristics(ServiceLifetime.Scoped, multipleRegistrations: true) },
{ typeof(IResettableService), new ServiceCharacteristics(ServiceLifetime.Scoped, multipleRegistrations: true) },

// New Query related services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure
/// </para>
/// <para>
/// The service lifetime is <see cref="ServiceLifetime" /> and multiple registrations
/// are allowed. This means that each <see cref="IConventionSetCustomizer" /> instance will use its own
/// are allowed. This means that each <see cref="IConventionSetPlugin" /> instance will use its own
/// set of instances of this service.
/// The implementations may depend on other services registered with any lifetime.
/// The implementations do not need to be thread-safe.
/// </para>
/// </summary>
public interface IConventionSetCustomizer
public interface IConventionSetPlugin
{
/// <summary>
/// Called to customize or otherwise modify the given convention set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure
/// <summary>
/// <para>
/// A service on the EF internal service provider that creates the <see cref="ConventionSet" />
/// for the current database provider. This is combined with <see cref="IConventionSetCustomizer" />
/// for the current database provider. This is combined with <see cref="IConventionSetPlugin" />
/// instances to produce the full convention set exposed by the <see cref="IConventionSetBuilder" />
/// service.
/// </para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure
/// <summary>
/// <para>
/// A service on the EF internal service provider that creates the <see cref="ConventionSet" />
/// for the current database provider. This is combined with <see cref="IConventionSetCustomizer" />
/// for the current database provider. This is combined with <see cref="IConventionSetPlugin" />
/// instances to produce the full convention set exposed by the <see cref="IConventionSetBuilder" />
/// service.
/// </para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal
public class RuntimeConventionSetBuilder : IConventionSetBuilder
{
private readonly IProviderConventionSetBuilder _conventionSetBuilder;
private readonly IList<IConventionSetCustomizer> _customizers;
private readonly IList<IConventionSetPlugin> _plugins;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand All @@ -37,10 +37,10 @@ public class RuntimeConventionSetBuilder : IConventionSetBuilder
/// </summary>
public RuntimeConventionSetBuilder(
[NotNull] IProviderConventionSetBuilder providerConventionSetBuilder,
[NotNull] IEnumerable<IConventionSetCustomizer> customizers)
[NotNull] IEnumerable<IConventionSetPlugin> plugins)
{
_conventionSetBuilder = providerConventionSetBuilder;
_customizers = customizers.ToList();
_plugins = plugins.ToList();
}

/// <summary>
Expand All @@ -53,9 +53,9 @@ public virtual ConventionSet CreateConventionSet()
{
var conventionSet = _conventionSetBuilder.CreateConventionSet();

foreach (var customizer in _customizers)
foreach (var plugin in _plugins)
{
conventionSet = customizer.ModifyConventions(conventionSet);
conventionSet = plugin.ModifyConventions(conventionSet);
}

return conventionSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ private ModelBuilder CreateModelBuilder()
return new ModelBuilder(
new RuntimeConventionSetBuilder(
new InMemoryConventionSetBuilder(dependencies),
Enumerable.Empty<IConventionSetCustomizer>())
Enumerable.Empty<IConventionSetPlugin>())
.CreateConventionSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private ModelBuilder CreateModelBuilder()
return new ModelBuilder(
new RuntimeConventionSetBuilder(
new ProviderConventionSetBuilder(dependencies),
Enumerable.Empty<IConventionSetCustomizer>())
Enumerable.Empty<IConventionSetPlugin>())
.CreateConventionSet());
}

Expand Down
2 changes: 1 addition & 1 deletion test/EFCore.Tests/ModelSourceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Adds_all_entities_based_on_all_distinct_entity_types_found()
InMemoryTestHelpers.Instance.CreateContext(),
new RuntimeConventionSetBuilder(new ProviderConventionSetBuilder(
InMemoryTestHelpers.Instance.CreateContextServices().GetRequiredService<ProviderConventionSetBuilderDependencies>()
.With(setFinder)), new List<IConventionSetCustomizer>()));
.With(setFinder)), new List<IConventionSetPlugin>()));

Assert.Equal(
new[] { typeof(SetA).DisplayName(), typeof(SetB).DisplayName() },
Expand Down

0 comments on commit 518fb82

Please sign in to comment.