diff --git a/src/Conventions.Abstractions/ConventionHostBuilderExtensions.cs b/src/Conventions.Abstractions/ConventionHostBuilderExtensions.cs index c348f5ddf..3fe626cc4 100644 --- a/src/Conventions.Abstractions/ConventionHostBuilderExtensions.cs +++ b/src/Conventions.Abstractions/ConventionHostBuilderExtensions.cs @@ -23,6 +23,7 @@ public static class ConventionHostBuilderExtensions /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder SetupConvention( this ConventionContextBuilder container, @@ -43,6 +44,7 @@ public static ConventionContextBuilder SetupConvention( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder SetupConvention( this ConventionContextBuilder container, @@ -121,6 +123,7 @@ FuncThe container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -131,7 +134,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(@delegate, priority, category); + container.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return container; } @@ -141,6 +144,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -151,7 +155,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(@delegate, priority, category); + container.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return container; } @@ -161,6 +165,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -171,7 +176,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ServiceConvention((_, configuration, services) => @delegate(configuration, services)), priority, category); + container.AppendDelegate(new ServiceConvention((_, configuration, services) => @delegate(configuration, services)), priority, category ?? ConventionCategory.Core); return container; } @@ -181,6 +186,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -193,7 +199,7 @@ public static ConventionContextBuilder ConfigureServices( container.AppendDelegate( new ServiceAsyncConvention((_, configuration, services, cancellationToken) => @delegate(configuration, services, cancellationToken)), priority, - category + category ?? ConventionCategory.Core ); return container; } @@ -204,6 +210,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -214,7 +221,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ServiceAsyncConvention((_, configuration, services, _) => @delegate(configuration, services)), priority, category); + container.AppendDelegate(new ServiceAsyncConvention((_, configuration, services, _) => @delegate(configuration, services)), priority, category ?? ConventionCategory.Core); return container; } @@ -224,6 +231,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -234,7 +242,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ServiceConvention((_, _, services) => @delegate(services)), priority, category); + container.AppendDelegate(new ServiceConvention((_, _, services) => @delegate(services)), priority, category ?? ConventionCategory.Core); return container; } @@ -244,6 +252,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -254,7 +263,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ServiceAsyncConvention((_, _, services, _) => @delegate(services)), priority, category); + container.AppendDelegate(new ServiceAsyncConvention((_, _, services, _) => @delegate(services)), priority, category ?? ConventionCategory.Core); return container; } @@ -264,6 +273,7 @@ public static ConventionContextBuilder ConfigureServices( /// The container. /// The delegate. /// The priority. + /// The category. /// . public static ConventionContextBuilder ConfigureServices( this ConventionContextBuilder container, @@ -274,7 +284,7 @@ public static ConventionContextBuilder ConfigureServices( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ServiceAsyncConvention((_, _, services, cancellationToken) => @delegate(services, cancellationToken)), priority, category); + container.AppendDelegate(new ServiceAsyncConvention((_, _, services, cancellationToken) => @delegate(services, cancellationToken)), priority, category ?? ConventionCategory.Core); return container; } @@ -295,7 +305,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(@delegate, priority, category); + container.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return container; } @@ -316,7 +326,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(@delegate, priority, category); + container.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return container; } @@ -337,7 +347,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new LoggingConvention((_, configuration, builder) => @delegate(configuration, builder)), priority, category); + container.AppendDelegate(new LoggingConvention((_, configuration, builder) => @delegate(configuration, builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -361,7 +371,7 @@ public static ConventionContextBuilder ConfigureLogging( container.AppendDelegate( new LoggingAsyncConvention((_, configuration, builder, cancellationToken) => @delegate(configuration, builder, cancellationToken)), priority, - category + category ?? ConventionCategory.Core ); return container; } @@ -383,7 +393,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new LoggingAsyncConvention((_, configuration, builder, _) => @delegate(configuration, builder)), priority, category); + container.AppendDelegate(new LoggingAsyncConvention((_, configuration, builder, _) => @delegate(configuration, builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -404,7 +414,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new LoggingConvention((_, _, builder) => @delegate(builder)), priority, category); + container.AppendDelegate(new LoggingConvention((_, _, builder) => @delegate(builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -425,7 +435,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new LoggingAsyncConvention((_, _, builder, cancellationToken) => @delegate(builder, cancellationToken)), priority, category); + container.AppendDelegate(new LoggingAsyncConvention((_, _, builder, cancellationToken) => @delegate(builder, cancellationToken)), priority, category ?? ConventionCategory.Core); return container; } @@ -446,7 +456,7 @@ public static ConventionContextBuilder ConfigureLogging( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new LoggingAsyncConvention((_, _, builder, _) => @delegate(builder)), priority, category); + container.AppendDelegate(new LoggingAsyncConvention((_, _, builder, _) => @delegate(builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -467,7 +477,7 @@ public static ConventionContextBuilder ConfigureConfiguration( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(@delegate, priority, category); + container.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return container; } @@ -488,7 +498,7 @@ public static ConventionContextBuilder ConfigureConfiguration( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(@delegate, priority, category); + container.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return container; } @@ -509,7 +519,7 @@ public static ConventionContextBuilder ConfigureConfiguration( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ConfigurationConvention((_, configuration, builder) => @delegate(configuration, builder)), priority, category); + container.AppendDelegate(new ConfigurationConvention((_, configuration, builder) => @delegate(configuration, builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -533,7 +543,7 @@ public static ConventionContextBuilder ConfigureConfiguration( container.AppendDelegate( new ConfigurationAsyncConvention((_, configuration, builder, cancellationToken) => @delegate(configuration, builder, cancellationToken)), priority, - category + category ?? ConventionCategory.Core ); return container; } @@ -555,7 +565,7 @@ public static ConventionContextBuilder ConfigureConfiguration( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ConfigurationAsyncConvention((_, configuration, builder, _) => @delegate(configuration, builder)), priority, category); + container.AppendDelegate(new ConfigurationAsyncConvention((_, configuration, builder, _) => @delegate(configuration, builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -576,7 +586,7 @@ public static ConventionContextBuilder ConfigureConfiguration( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ConfigurationConvention((_, _, builder) => @delegate(builder)), priority, category); + container.AppendDelegate(new ConfigurationConvention((_, _, builder) => @delegate(builder)), priority, category ?? ConventionCategory.Core); return container; } @@ -600,7 +610,7 @@ public static ConventionContextBuilder ConfigureConfiguration( container.AppendDelegate( new ConfigurationAsyncConvention((_, _, builder, cancellationToken) => @delegate(builder, cancellationToken)), priority, - category + category ?? ConventionCategory.Core ); return container; } @@ -622,7 +632,7 @@ public static ConventionContextBuilder ConfigureConfiguration( { ArgumentNullException.ThrowIfNull(container); - container.AppendDelegate(new ConfigurationAsyncConvention((_, _, builder, _) => @delegate(builder)), priority, category); + container.AppendDelegate(new ConfigurationAsyncConvention((_, _, builder, _) => @delegate(builder)), priority, category ?? ConventionCategory.Core); return container; } diff --git a/src/Conventions.Autofac/AutofacExtensions.cs b/src/Conventions.Autofac/AutofacExtensions.cs index 0f28a389f..98598d177 100644 --- a/src/Conventions.Autofac/AutofacExtensions.cs +++ b/src/Conventions.Autofac/AutofacExtensions.cs @@ -26,7 +26,7 @@ public static async ValueTask ApplyConventionsAsync( ) { var configuration = context.Get() ?? throw new ArgumentException("Configuration was not found in context"); - foreach (var item in context.Conventions.Get()) + foreach (var item in context.Conventions.Get()) { switch (item) { @@ -47,4 +47,4 @@ public static async ValueTask ApplyConventionsAsync( return containerBuilder; } -} \ No newline at end of file +} diff --git a/src/Conventions.Autofac/AutofacRocketHostExtensions.cs b/src/Conventions.Autofac/AutofacRocketHostExtensions.cs index c72a9c946..24c591f5a 100644 --- a/src/Conventions.Autofac/AutofacRocketHostExtensions.cs +++ b/src/Conventions.Autofac/AutofacRocketHostExtensions.cs @@ -47,7 +47,7 @@ public static ConventionContextBuilder ConfigureAutofac( { ArgumentNullException.ThrowIfNull(builder); - builder.AppendDelegate(@delegate, priority, category); + builder.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return builder; } @@ -71,7 +71,7 @@ public static ConventionContextBuilder ConfigureAutofac( builder.AppendDelegate( new AutofacConvention((_, configuration, services, container) => @delegate(configuration, services, container)), priority, - category + category ?? ConventionCategory.Core ); return builder; } @@ -93,7 +93,7 @@ public static ConventionContextBuilder ConfigureAutofac( { ArgumentNullException.ThrowIfNull(builder); - builder.AppendDelegate(new AutofacConvention((_, _, services, container) => @delegate(services, container)), priority, category); + builder.AppendDelegate(new AutofacConvention((_, _, services, container) => @delegate(services, container)), priority, category ?? ConventionCategory.Core); return builder; } @@ -114,7 +114,7 @@ public static ConventionContextBuilder ConfigureAutofac( { ArgumentNullException.ThrowIfNull(builder); - builder.AppendDelegate(new AutofacConvention((_, _, _, container) => @delegate(container)), priority, category); + builder.AppendDelegate(new AutofacConvention((_, _, _, container) => @delegate(container)), priority, category ?? ConventionCategory.Core); return builder; } } diff --git a/src/Conventions.DryIoc/DryIocExtensions.cs b/src/Conventions.DryIoc/DryIocExtensions.cs index 153e864cc..263ac8a1f 100644 --- a/src/Conventions.DryIoc/DryIocExtensions.cs +++ b/src/Conventions.DryIoc/DryIocExtensions.cs @@ -27,7 +27,7 @@ public static async ValueTask ApplyConventionsAsync( ) { var configuration = context.Get() ?? throw new ArgumentException("Configuration was not found in context"); - foreach (var item in context.Conventions.Get()) + foreach (var item in context.Conventions.Get()) { container = item switch { @@ -47,4 +47,4 @@ public static async ValueTask ApplyConventionsAsync( return container; } -} \ No newline at end of file +} diff --git a/src/Conventions.DryIoc/DryIocRocketHostExtensions.cs b/src/Conventions.DryIoc/DryIocRocketHostExtensions.cs index 3d691705d..7c75b0e04 100644 --- a/src/Conventions.DryIoc/DryIocRocketHostExtensions.cs +++ b/src/Conventions.DryIoc/DryIocRocketHostExtensions.cs @@ -46,7 +46,7 @@ public static ConventionContextBuilder ConfigureDryIoc( { ArgumentNullException.ThrowIfNull(builder); - builder.AppendDelegate(@delegate, priority, category); + builder.AppendDelegate(@delegate, priority, category ?? ConventionCategory.Core); return builder; } @@ -76,7 +76,7 @@ public static ConventionContextBuilder ConfigureDryIoc( } ), priority, - category + category ?? ConventionCategory.Core ); return builder; } @@ -128,7 +128,7 @@ public static ConventionContextBuilder ConfigureDryIoc( } ), priority, - category + category ?? ConventionCategory.Core ); return builder; } @@ -153,7 +153,7 @@ public static ConventionContextBuilder ConfigureDryIoc( builder.AppendDelegate( new DryIocConvention((_, configuration, services, container) => @delegate(configuration, services, container)), priority, - category + category ?? ConventionCategory.Core ); return builder; } @@ -184,7 +184,7 @@ public static ConventionContextBuilder ConfigureDryIoc( } ), priority, - category + category ?? ConventionCategory.Core ); return builder; } @@ -206,7 +206,7 @@ public static ConventionContextBuilder ConfigureDryIoc( { ArgumentNullException.ThrowIfNull(builder); - builder.AppendDelegate(new DryIocConvention((_, _, _, container) => @delegate(container)), priority, category); + builder.AppendDelegate(new DryIocConvention((_, _, _, container) => @delegate(container)), priority, category ?? ConventionCategory.Core); return builder; } @@ -236,7 +236,7 @@ public static ConventionContextBuilder ConfigureDryIoc( } ), priority, - category + category ?? ConventionCategory.Core ); return builder; }