Skip to content

Commit

Permalink
Revitalize M.E.DependencyInjection.AutoActivation
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Taillefer committed Jul 17, 2023
1 parent 5352825 commit d39bd31
Show file tree
Hide file tree
Showing 34 changed files with 90 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\..\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.Compliance.Abstractions\Microsoft.Extensions.Compliance.Abstractions.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.Telemetry.Abstractions\Microsoft.Extensions.Telemetry.Abstractions.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Telemetry\Microsoft.AspNetCore.Telemetry.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\..\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<ItemGroup>
<ProjectReference Include="..\Microsoft.Extensions.Compliance.Abstractions\Microsoft.Extensions.Compliance.Abstractions.csproj" />
<ProjectReference Include="..\..\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\..\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static IServiceCollection Activate<TService>(this IServiceCollection serv
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in TService with an implementation
/// Adds an auto-activated singleton service of the type specified in TService with an implementation
/// type specified in TImplementation using the factory specified in implementationFactory
/// to the specified <see cref="IServiceCollection"/>.
/// </summary>
Expand All @@ -50,7 +50,7 @@ public static IServiceCollection AddActivatedSingleton<TService, TImplementation
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in TService with a factory specified
/// Adds an auto-activated singleton service of the type specified in TService with a factory specified
/// in implementationFactory to the specified <see cref="IServiceCollection"/>.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the service to.</param>
Expand All @@ -64,7 +64,7 @@ public static IServiceCollection AddActivatedSingleton<TService>(this IServiceCo
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in TService to the specified <see cref="IServiceCollection"/>.
/// Adds an auto-activated singleton service of the type specified in TService to the specified <see cref="IServiceCollection"/>.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the service to.</param>
/// <typeparam name="TService">The type of the service to add.</typeparam>
Expand Down Expand Up @@ -140,7 +140,7 @@ public static IServiceCollection AddActivatedSingleton(this IServiceCollection s
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in serviceType to the specified
/// Adds an auto-activated singleton service of the type specified in serviceType to the specified
/// <see cref="IServiceCollection"/> if the service type hasn't already been registered.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the service to.</param>
Expand All @@ -154,7 +154,7 @@ public static void TryAddActivatedSingleton(this IServiceCollection services, Ty
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in serviceType with an implementation
/// Adds an auto-activated singleton service of the type specified in serviceType with an implementation
/// of the type specified in implementationType to the specified <see cref="IServiceCollection"/>
/// if the service type hasn't already been registered.
/// </summary>
Expand All @@ -171,7 +171,7 @@ public static void TryAddActivatedSingleton(this IServiceCollection services, Ty
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in serviceType with a factory
/// Adds an auto-activated singleton service of the type specified in serviceType with a factory
/// specified in implementationFactory to the specified <see cref="IServiceCollection"/>
/// if the service type hasn't already been registered.
/// </summary>
Expand All @@ -188,7 +188,7 @@ public static void TryAddActivatedSingleton(this IServiceCollection services, Ty
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in TService
/// Adds an auto-activated singleton service of the type specified in TService
/// to the specified <see cref="IServiceCollection"/>
/// if the service type hasn't already been registered.
/// </summary>
Expand All @@ -203,7 +203,7 @@ public static void TryAddActivatedSingleton<TService>(this IServiceCollection se
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in TService with an implementation
/// Adds an auto-activated singleton service of the type specified in TService with an implementation
/// type specified in TImplementation using the factory specified in implementationFactory
/// to the specified <see cref="IServiceCollection"/>
/// if the service type hasn't already been registered.
Expand All @@ -221,7 +221,7 @@ public static void TryAddActivatedSingleton<TService, TImplementation>(this ISer
}

/// <summary>
/// Adds an autoactivated singleton service of the type specified in serviceType with a factory
/// Adds an auto-activated singleton service of the type specified in serviceType with a factory
/// specified in implementationFactory to the specified <see cref="IServiceCollection"/>
/// if the service type hasn't already been registered.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace Microsoft.Extensions.DependencyInjection;

internal sealed class AutoActivatorOptions
{
public HashSet<Type> AutoActivators { get; } = new HashSet<Type>();
public HashSet<Type> AutoActivators { get; } = new();
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Microsoft.Extensions.DependencyInjection.AutoActivation</AssemblyName>
<RootNamespace>Microsoft.Extensions.DependencyInjection</RootNamespace>
<Description>Extensions to auto-activate registered singletons in the dependency injection system.</Description>
<Workstream>Fundamentals</Workstream>
<Category>Dependency Injection</Category>
</PropertyGroup>

<PropertyGroup>
<Stage>normal</Stage>
<TempMinCodeCoverage>66</TempMinCodeCoverage>
<MinCodeCoverage>100</MinCodeCoverage>
<MinMutationScore>100</MinMutationScore>
</PropertyGroup>
Expand All @@ -23,5 +19,4 @@
<ItemGroup>
<InternalsVisibleToTest Include="$(AssemblyName).Tests" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"Name": "Microsoft.Extensions.DependencyInjection.AutoActivation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Types": [
{
"Type": "static class Microsoft.Extensions.DependencyInjection.AutoActivationExtensions",
"Stage": "Stable",
"Methods": [
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.Activate<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton<TService, TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Func<System.IServiceProvider, TImplementation> implementationFactory);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Func<System.IServiceProvider, TService> implementationFactory);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton<TService, TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, System.Func<System.IServiceProvider, object> implementationFactory);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, System.Type implementationType);",
"Stage": "Stable"
},
{
"Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType);",
"Stage": "Stable"
},
{
"Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, System.Type implementationType);",
"Stage": "Stable"
},
{
"Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, System.Func<System.IServiceProvider, object> implementationFactory);",
"Stage": "Stable"
},
{
"Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);",
"Stage": "Stable"
},
{
"Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton<TService, TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);",
"Stage": "Stable"
},
{
"Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Func<System.IServiceProvider, TService> implementationFactory);",
"Stage": "Stable"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<ItemGroup>
<ProjectReference Include="..\Microsoft.Extensions.Telemetry.Abstractions\Microsoft.Extensions.Telemetry.Abstractions.csproj" />
<ProjectReference Include="..\..\ToBeRemoved\Options.ValidateOnStart\Options.ValidateOnStart.csproj" />
<ProjectReference Include="..\..\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\..\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\..\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.Telemetry\Microsoft.Extensions.Telemetry.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.EnumStrings\Microsoft.Extensions.EnumStrings.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\..\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.AmbientMetadata.Application\Microsoft.Extensions.AmbientMetadata.Application.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.Compliance.Abstractions\Microsoft.Extensions.Compliance.Abstractions.csproj" />
<ProjectReference Include="..\Microsoft.Extensions.Telemetry.Abstractions\Microsoft.Extensions.Telemetry.Abstractions.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,4 +636,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Microsoft.Extensions.DependencyInjection.AutoActivation.Tests</AssemblyName>
<RootNamespace>Microsoft.Extensions.DependencyInjection.Test</RootNamespace>
<Description>Tests for Microsoft.Extensions.DependencyInjection.AutoActivation</Description>
<Description>Unit tests for Microsoft.Extensions.DependencyInjection.AutoActivation.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" />
<ProjectReference Include="..\..\..\src\ToBeMoved\DependencyInjection.AutoActivation\DependencyInjection.AutoActivation.csproj" ProjectUnderTest="true" />
<ProjectReference Include="..\..\..\src\Libraries\Microsoft.Extensions.DependencyInjection.AutoActivation\Microsoft.Extensions.DependencyInjection.AutoActivation.csproj" ProjectUnderTest="true" />
<ProjectReference Include="..\..\..\src\Libraries\Microsoft.Extensions.Hosting.Testing\Microsoft.Extensions.Hosting.Testing.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" />
</ItemGroup>
</Project>

0 comments on commit d39bd31

Please sign in to comment.