From f86f6ecddcfa0a5967e7b0a79e06c89030965a94 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Sat, 4 Feb 2023 12:08:22 -0800 Subject: [PATCH 1/6] Analyzer optimization - use local function. --- .../Scanning/OpenGenericScanningRegistrationExtensions.cs | 8 +++----- .../Features/Scanning/ScanningRegistrationExtensions.cs | 8 +++----- src/Autofac/ModuleRegistrationExtensions.cs | 6 +++--- src/Autofac/RegistrationExtensions.Conditional.cs | 6 +++--- .../Resolution/ConstructorFinderTests.cs | 7 ++++--- test/Autofac.Test/Concurrency/ConcurrencyTests.cs | 8 ++++---- .../Core/Registration/ComponentRegistryTests.cs | 4 ++-- 7 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs b/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs index 2075f8dfd..7f2eb32c9 100644 --- a/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs +++ b/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs @@ -96,16 +96,14 @@ private static void ScanAssemblies(IEnumerable assemblies, IComponentR .Where(t => t.IsGenericTypeDefinition) .CanBeRegistered(rb.ActivatorData); - Func> scannedConstructor = - (type) => new RegistrationBuilder( + static IRegistrationBuilder TypeBuilderFactory(Type type) => new RegistrationBuilder( new TypedService(type), new ReflectionActivatorData(type), new DynamicRegistrationStyle()); - Action> register = - (cr, scanned) => cr.AddRegistrationSource(new OpenGenericRegistrationSource(scanned.RegistrationData, scanned.ResolvePipeline, scanned.ActivatorData)); + static void RegistrationSourceFactory(IComponentRegistryBuilder cr, IRegistrationBuilder scanned) => cr.AddRegistrationSource(new OpenGenericRegistrationSource(scanned.RegistrationData, scanned.ResolvePipeline, scanned.ActivatorData)); - ScanTypesTemplate(types, cr, rb, scannedConstructor, register); + ScanTypesTemplate(types, cr, rb, TypeBuilderFactory, RegistrationSourceFactory); } private static void ScanTypesTemplate( diff --git a/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs b/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs index 133178e4e..8a40865a9 100644 --- a/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs +++ b/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs @@ -86,13 +86,11 @@ private static void ScanTypes(IEnumerable types, IComponentRegistryBuilder rb.RegistrationData.Services.OfType().All(swt => swt.ServiceType.IsAssignableFrom(t))); - Func> scannedConstructor = - (type) => RegistrationBuilder.ForType(type); + IRegistrationBuilder TypeBuilderFactory(Type type) => RegistrationBuilder.ForType(type); - Action> register = - (cr, scanned) => RegistrationBuilder.RegisterSingleComponent(cr, scanned); + void SingleComponentRegistration(IComponentRegistryBuilder cr, IRegistrationBuilder scanned) => RegistrationBuilder.RegisterSingleComponent(cr, scanned); - ScanTypesTemplate(closedTypes, cr, rb, scannedConstructor, register); + ScanTypesTemplate(closedTypes, cr, rb, TypeBuilderFactory, SingleComponentRegistration); } /// diff --git a/src/Autofac/ModuleRegistrationExtensions.cs b/src/Autofac/ModuleRegistrationExtensions.cs index c82eec66a..54774f447 100644 --- a/src/Autofac/ModuleRegistrationExtensions.cs +++ b/src/Autofac/ModuleRegistrationExtensions.cs @@ -278,15 +278,15 @@ public static IModuleRegistrar OnlyIf(this IModuleRegistrar registrar, Predicate var registrarCallback = registrar.RegistrarData.Callback; var original = registrarCallback.Callback; - Action updated = registry => + void Updated(IComponentRegistryBuilder registry) { if (predicate(registry)) { original(registry); } - }; + } - registrarCallback.Callback = updated; + registrarCallback.Callback = Updated; return registrar; } diff --git a/src/Autofac/RegistrationExtensions.Conditional.cs b/src/Autofac/RegistrationExtensions.Conditional.cs index 549a63ef3..0f1ba1f92 100644 --- a/src/Autofac/RegistrationExtensions.Conditional.cs +++ b/src/Autofac/RegistrationExtensions.Conditional.cs @@ -53,15 +53,15 @@ public static IRegistrationBuilder } var original = c.Callback; - Action updated = registry => + void Updated(IComponentRegistryBuilder registry) { if (predicate(registry)) { original(registry); } - }; + } - c.Callback = updated; + c.Callback = Updated; return registration; } diff --git a/test/Autofac.Specification.Test/Resolution/ConstructorFinderTests.cs b/test/Autofac.Specification.Test/Resolution/ConstructorFinderTests.cs index ae48de229..949bcbba8 100644 --- a/test/Autofac.Specification.Test/Resolution/ConstructorFinderTests.cs +++ b/test/Autofac.Specification.Test/Resolution/ConstructorFinderTests.cs @@ -92,13 +92,14 @@ public void FindConstructorsWith_FinderFunctionProvided_PassedToConstructorFinde { var cb = new ContainerBuilder(); var finderCalled = false; - Func finder = type => + ConstructorInfo[] Finder(Type type) { finderCalled = true; return type.GetConstructors(); - }; + } + cb.RegisterType(); - cb.RegisterType().FindConstructorsWith(finder); + cb.RegisterType().FindConstructorsWith(Finder); var container = cb.Build(); container.Resolve(); diff --git a/test/Autofac.Test/Concurrency/ConcurrencyTests.cs b/test/Autofac.Test/Concurrency/ConcurrencyTests.cs index 4c2802c65..5138f743b 100644 --- a/test/Autofac.Test/Concurrency/ConcurrencyTests.cs +++ b/test/Autofac.Test/Concurrency/ConcurrencyTests.cs @@ -106,7 +106,7 @@ public void WhenTwoThreadsInitializeASharedInstanceSimultaneouslyViaChildLifetim var container = builder.Build(); - ThreadStart work = () => + void Work() { try { @@ -117,10 +117,10 @@ public void WhenTwoThreadsInitializeASharedInstanceSimultaneouslyViaChildLifetim { exceptions.Add(ex); } - }; + } - var t1 = new Thread(work); - var t2 = new Thread(work); + var t1 = new Thread(Work); + var t2 = new Thread(Work); t1.Start(); t2.Start(); t1.Join(); diff --git a/test/Autofac.Test/Core/Registration/ComponentRegistryTests.cs b/test/Autofac.Test/Core/Registration/ComponentRegistryTests.cs index aa7fe6353..cb0a1e40c 100644 --- a/test/Autofac.Test/Core/Registration/ComponentRegistryTests.cs +++ b/test/Autofac.Test/Core/Registration/ComponentRegistryTests.cs @@ -318,9 +318,9 @@ public void AddingConcreteImplementationWhenAdapterImplementationsExist_AddsChai var pre = container.ComponentRegistry.RegistrationsFor(chainedService); Assert.Single(pre); - Func func = () => new object(); + static object ObjectFactory() => new(); using (var lifetimeScope = container.BeginLifetimeScope(builder => - builder.ComponentRegistryBuilder.Register(RegistrationBuilder.ForDelegate((c, p) => func).CreateRegistration()))) + builder.ComponentRegistryBuilder.Register(RegistrationBuilder.ForDelegate((c, p) => (Func)ObjectFactory).CreateRegistration()))) { var post = lifetimeScope.ComponentRegistry.RegistrationsFor(chainedService); Assert.Equal(2, post.Count()); From f00050aca155d805562a61a41e165c978e7b78a5 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Sat, 4 Feb 2023 12:10:39 -0800 Subject: [PATCH 2/6] Analyzer optimization: Use conditional setting. --- .../Registration/ServiceRegistrationInfo.cs | 29 ++++--------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/Autofac/Core/Registration/ServiceRegistrationInfo.cs b/src/Autofac/Core/Registration/ServiceRegistrationInfo.cs index 5740e2b9e..bd0c5e43b 100644 --- a/src/Autofac/Core/Registration/ServiceRegistrationInfo.cs +++ b/src/Autofac/Core/Registration/ServiceRegistrationInfo.cs @@ -177,20 +177,12 @@ public void AddImplementation(IComponentRegistration registration, bool preserve { if (originatedFromSource) { - if (_sourceImplementations == null) - { - _sourceImplementations = new List(); - } - + _sourceImplementations ??= new List(); _sourceImplementations.Add(registration); } else { - if (_preserveDefaultImplementations == null) - { - _preserveDefaultImplementations = new List(); - } - + _preserveDefaultImplementations ??= new List(); _preserveDefaultImplementations.Add(registration); } } @@ -214,11 +206,7 @@ public void AddImplementation(IComponentRegistration registration, bool preserve /// The insertion mode for the pipeline. public void UseServiceMiddleware(IResolveMiddleware middleware, MiddlewareInsertionMode insertionMode = MiddlewareInsertionMode.EndOfPhase) { - if (_customPipelineBuilder is null) - { - _customPipelineBuilder = new ResolvePipelineBuilder(PipelineType.Service); - } - + _customPipelineBuilder ??= new ResolvePipelineBuilder(PipelineType.Service); _customPipelineBuilder.Use(middleware, insertionMode); } @@ -234,11 +222,7 @@ public void UseServiceMiddlewareRange(IEnumerable middleware return; } - if (_customPipelineBuilder is null) - { - _customPipelineBuilder = new ResolvePipelineBuilder(PipelineType.Service); - } - + _customPipelineBuilder ??= new ResolvePipelineBuilder(PipelineType.Service); _customPipelineBuilder.UseRange(middleware, insertionMode); } @@ -280,10 +264,7 @@ public void BeginInitialization(IEnumerable sources) // Build the pipeline during service info initialization, so that sources can access it // while getting a registration recursively. - if (_resolvePipeline is null) - { - _resolvePipeline = BuildPipeline(); - } + _resolvePipeline ??= BuildPipeline(); } /// From d6c48578cefd351d8f2fb458e9ea93007702bde8 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Sat, 4 Feb 2023 12:12:54 -0800 Subject: [PATCH 3/6] Analyzer optimization: Make struct readonly. --- src/Autofac/Core/Resolving/SegmentedStack.cs | 2 +- src/Autofac/Core/ServiceRegistration.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Autofac/Core/Resolving/SegmentedStack.cs b/src/Autofac/Core/Resolving/SegmentedStack.cs index 5833d58c2..e75b774d2 100644 --- a/src/Autofac/Core/Resolving/SegmentedStack.cs +++ b/src/Autofac/Core/Resolving/SegmentedStack.cs @@ -112,7 +112,7 @@ IEnumerator IEnumerable.GetEnumerator() return new Enumerator(this); } - private struct StackSegment : IDisposable + private readonly struct StackSegment : IDisposable { private readonly SegmentedStack _stack; private readonly int _resetPosition; diff --git a/src/Autofac/Core/ServiceRegistration.cs b/src/Autofac/Core/ServiceRegistration.cs index 63935cc57..2a51d0e8e 100644 --- a/src/Autofac/Core/ServiceRegistration.cs +++ b/src/Autofac/Core/ServiceRegistration.cs @@ -9,7 +9,7 @@ namespace Autofac.Core; /// /// Defines a combination of a service pipeline and a registration. Used to instantiate a . /// -public struct ServiceRegistration : IEquatable +public readonly struct ServiceRegistration : IEquatable { /// /// Initializes a new instance of the struct. From 8891bfc080482fcef40865959ff5ec2e2e5265d7 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Sat, 4 Feb 2023 12:27:20 -0800 Subject: [PATCH 4/6] RegisterGeneratedFactory is obsolete This includes: - GeneratedFactoryActivatorData being obsolete - Suppressing the obsolete warnings around unit tests temporarily until it's removed. --- src/Autofac/Builder/RegistrationExtensions.cs | 7 +++++++ .../GeneratedFactories/GeneratedFactoryActivatorData.cs | 1 + .../GeneratedFactoryRegistrationExtensions.cs | 2 ++ .../Registration/RegistrationOnlyIfTests.cs | 2 ++ .../GeneratedFactories/GeneratedFactoriesTests.cs | 8 +++++--- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Autofac/Builder/RegistrationExtensions.cs b/src/Autofac/Builder/RegistrationExtensions.cs index ca5723656..c0641a3fd 100644 --- a/src/Autofac/Builder/RegistrationExtensions.cs +++ b/src/Autofac/Builder/RegistrationExtensions.cs @@ -25,6 +25,7 @@ public static class RegistrationExtensions /// Registration builder allowing the registration to be configured. /// Factory delegates are provided automatically in Autofac 2, /// and this method is generally not required. + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder RegisterGeneratedFactory(this ContainerBuilder builder, Type delegateType) { @@ -48,6 +49,7 @@ public static IRegistrationBuilderRegistration builder allowing the registration to be configured. /// Factory delegates are provided automatically in Autofac 2, and /// this method is generally not required. + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder RegisterGeneratedFactory(this ContainerBuilder builder, Type delegateType, Service service) { @@ -68,6 +70,7 @@ public static IRegistrationBuilderRegistration builder allowing the registration to be configured. /// Factory delegates are provided automatically in Autofac 2, /// and this method is generally not required. + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder RegisterGeneratedFactory(this ContainerBuilder builder, Service service) where TDelegate : class @@ -88,6 +91,7 @@ public static IRegistrationBuilderRegistration builder allowing the registration to be configured. /// Factory delegates are provided automatically in Autofac 2, /// and this method is generally not required. + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder RegisterGeneratedFactory(this ContainerBuilder builder) where TDelegate : class @@ -115,6 +119,7 @@ public static IRegistrationBuilder /// Thrown if is . /// + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder NamedParameterMapping( this IRegistrationBuilder registration) @@ -142,6 +147,7 @@ public static IRegistrationBuilder /// Thrown if is . /// + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder PositionalParameterMapping( this IRegistrationBuilder registration) @@ -169,6 +175,7 @@ public static IRegistrationBuilder /// Thrown if is . /// + [Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public static IRegistrationBuilder TypedParameterMapping( this IRegistrationBuilder registration) diff --git a/src/Autofac/Features/GeneratedFactories/GeneratedFactoryActivatorData.cs b/src/Autofac/Features/GeneratedFactories/GeneratedFactoryActivatorData.cs index 2f815ed20..2fbd78b83 100644 --- a/src/Autofac/Features/GeneratedFactories/GeneratedFactoryActivatorData.cs +++ b/src/Autofac/Features/GeneratedFactories/GeneratedFactoryActivatorData.cs @@ -10,6 +10,7 @@ namespace Autofac.Features.GeneratedFactories; /// /// Data used to create factory activators. /// +[Obsolete("Update your code to use the Func implicit relationship or delegate factories. See https://autofac.readthedocs.io/en/latest/resolve/relationships.html and https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html for more information.")] public class GeneratedFactoryActivatorData : IConcreteActivatorData { private readonly Type _delegateType; diff --git a/src/Autofac/Features/GeneratedFactories/GeneratedFactoryRegistrationExtensions.cs b/src/Autofac/Features/GeneratedFactories/GeneratedFactoryRegistrationExtensions.cs index 131aa9fd7..8944ec3eb 100644 --- a/src/Autofac/Features/GeneratedFactories/GeneratedFactoryRegistrationExtensions.cs +++ b/src/Autofac/Features/GeneratedFactories/GeneratedFactoryRegistrationExtensions.cs @@ -6,6 +6,8 @@ namespace Autofac.Features.GeneratedFactories; +#pragma warning disable CS0618 + /// /// Helper methods for registering factories. /// diff --git a/test/Autofac.Specification.Test/Registration/RegistrationOnlyIfTests.cs b/test/Autofac.Specification.Test/Registration/RegistrationOnlyIfTests.cs index 1fffc6ea7..9c20e2e53 100644 --- a/test/Autofac.Specification.Test/Registration/RegistrationOnlyIfTests.cs +++ b/test/Autofac.Specification.Test/Registration/RegistrationOnlyIfTests.cs @@ -237,10 +237,12 @@ public void OnlyIf_EnabledByStandardRegistrations() builder.RegisterDecorator((ctx, p, s) => new Decorator(s), "from").OnlyIf(r => true); builder.RegisterDecorator((ctx, s) => new Decorator(s), "from").OnlyIf(r => true); builder.RegisterDecorator(s => new Decorator(s), "from").OnlyIf(r => true); +#pragma warning disable CS0618 builder.RegisterGeneratedFactory(typeof(SimpleFactory)).OnlyIf(r => true); builder.RegisterGeneratedFactory(typeof(SimpleFactory), new TypedService(typeof(object))).OnlyIf(r => true); builder.RegisterGeneratedFactory().OnlyIf(r => true); builder.RegisterGeneratedFactory(new TypedService(typeof(object))).OnlyIf(r => true); +#pragma warning restore CS0618 builder.RegisterGeneric(typeof(SimpleGeneric<>)).OnlyIf(r => true); builder.RegisterGenericDecorator(typeof(Decorator<>), typeof(IService<>), fromKey: "b").OnlyIf(r => true); builder.RegisterInstance(new object()).OnlyIf(r => true); diff --git a/test/Autofac.Test/Features/GeneratedFactories/GeneratedFactoriesTests.cs b/test/Autofac.Test/Features/GeneratedFactories/GeneratedFactoriesTests.cs index 0e04a5581..55b7f49cd 100644 --- a/test/Autofac.Test/Features/GeneratedFactories/GeneratedFactoriesTests.cs +++ b/test/Autofac.Test/Features/GeneratedFactories/GeneratedFactoriesTests.cs @@ -6,6 +6,8 @@ namespace Autofac.Test.Features.GeneratedFactories; +#pragma warning disable CS0618 + public class GeneratedFactoriesTests { public class A @@ -164,7 +166,7 @@ public void RespectsContexts() } [Fact] - public void CanSetParmeterMappingToPositional() + public void CanSetParameterMappingToPositional() { var builder = new ContainerBuilder(); @@ -259,7 +261,7 @@ public void WillNotAutoGenerateFactoriesWhenProductNotRegistered() } [Fact] - public void CreateGenericFromNongenericFactoryDelegate() + public void CreateGenericFromNonGenericFactoryDelegate() { var builder = new ContainerBuilder(); @@ -278,7 +280,7 @@ public void CreateGenericFromNongenericFactoryDelegate() } [Fact] - public void CreateGenericFromNongenericFactoryDelegateImpliedServiceType() + public void CreateGenericFromNonGenericFactoryDelegateImpliedServiceType() { var builder = new ContainerBuilder(); From e26e84282a96f07418000e40ae8bb65c511c5f82 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Sat, 4 Feb 2023 12:32:03 -0800 Subject: [PATCH 5/6] Suppress obsolete warning on test. --- .../OwnedInstances/OwnedInstanceRegistrationSourceTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Autofac.Test/Features/OwnedInstances/OwnedInstanceRegistrationSourceTests.cs b/test/Autofac.Test/Features/OwnedInstances/OwnedInstanceRegistrationSourceTests.cs index 743c885f0..df3e4e96b 100644 --- a/test/Autofac.Test/Features/OwnedInstances/OwnedInstanceRegistrationSourceTests.cs +++ b/test/Autofac.Test/Features/OwnedInstances/OwnedInstanceRegistrationSourceTests.cs @@ -38,6 +38,7 @@ public void CallingDisposeOnGeneratedOwnedT_DoesNotDisposeCurrentLifetimeScope() Assert.False(containerDisposeTracker.IsDisposed); } +#pragma warning disable CS0618 [Fact] public void CanResolveAndUse_OwnedGeneratedFactory() { @@ -55,6 +56,7 @@ public void CanResolveAndUse_OwnedGeneratedFactory() Assert.True(isAccessed); } +#pragma warning restore CS0618 [Fact] public void IfInnerTypeIsNotRegistered_OwnedTypeIsNotEither() From 75261ae741a9f39250d10c123797d939c4cda5fe Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Mon, 6 Feb 2023 08:10:35 -0800 Subject: [PATCH 6/6] Mark local functions static. --- .../Scanning/OpenGenericScanningRegistrationExtensions.cs | 2 +- .../Features/Scanning/ScanningRegistrationExtensions.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs b/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs index 7f2eb32c9..09bb80db7 100644 --- a/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs +++ b/src/Autofac/Features/Scanning/OpenGenericScanningRegistrationExtensions.cs @@ -101,7 +101,7 @@ private static void ScanAssemblies(IEnumerable assemblies, IComponentR new ReflectionActivatorData(type), new DynamicRegistrationStyle()); - static void RegistrationSourceFactory(IComponentRegistryBuilder cr, IRegistrationBuilder scanned) => cr.AddRegistrationSource(new OpenGenericRegistrationSource(scanned.RegistrationData, scanned.ResolvePipeline, scanned.ActivatorData)); + static void RegistrationSourceFactory(IComponentRegistryBuilder registry, IRegistrationBuilder data) => registry.AddRegistrationSource(new OpenGenericRegistrationSource(data.RegistrationData, data.ResolvePipeline, data.ActivatorData)); ScanTypesTemplate(types, cr, rb, TypeBuilderFactory, RegistrationSourceFactory); } diff --git a/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs b/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs index 8a40865a9..22a65906b 100644 --- a/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs +++ b/src/Autofac/Features/Scanning/ScanningRegistrationExtensions.cs @@ -86,9 +86,9 @@ private static void ScanTypes(IEnumerable types, IComponentRegistryBuilder rb.RegistrationData.Services.OfType().All(swt => swt.ServiceType.IsAssignableFrom(t))); - IRegistrationBuilder TypeBuilderFactory(Type type) => RegistrationBuilder.ForType(type); + static IRegistrationBuilder TypeBuilderFactory(Type type) => RegistrationBuilder.ForType(type); - void SingleComponentRegistration(IComponentRegistryBuilder cr, IRegistrationBuilder scanned) => RegistrationBuilder.RegisterSingleComponent(cr, scanned); + static void SingleComponentRegistration(IComponentRegistryBuilder registry, IRegistrationBuilder data) => RegistrationBuilder.RegisterSingleComponent(registry, data); ScanTypesTemplate(closedTypes, cr, rb, TypeBuilderFactory, SingleComponentRegistration); }