< Summary

Information
Class: NexusLabs.Needlr.Injection.Syringe
Assembly: NexusLabs.Needlr.Injection
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Injection/Syringe.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 57
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Injection/Syringe.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2
 3using NexusLabs.Needlr.Injection.TypeFilterers;
 4
 5using System.Reflection;
 6
 7namespace NexusLabs.Needlr.Injection;
 8
 9/// <summary>
 10/// The base container for configuring Needlr service discovery.
 11/// </summary>
 12/// <remarks>
 13/// <para>
 14/// <see cref="Syringe"/> is a starting point that must be configured with a strategy before building.
 15/// Use one of these approaches to get a <see cref="ConfiguredSyringe"/> that can build a service provider:
 16/// </para>
 17/// <list type="bullet">
 18/// <item>Reference <c>NexusLabs.Needlr.Injection.SourceGen</c> and call <c>.UsingSourceGen()</c></item>
 19/// <item>Reference <c>NexusLabs.Needlr.Injection.Reflection</c> and call <c>.UsingReflection()</c></item>
 20/// <item>Reference <c>NexusLabs.Needlr.Injection.Bundle</c> and call <c>.UsingAutoConfiguration()</c></item>
 21/// </list>
 22/// <para>
 23/// The strategy methods return a <see cref="ConfiguredSyringe"/> which has the <c>BuildServiceProvider()</c> method.
 24/// </para>
 25/// </remarks>
 26/// <example>
 27/// <code>
 28/// // Using reflection
 29/// var provider = new Syringe()
 30///     .UsingReflection()
 31///     .BuildServiceProvider();
 32///
 33/// // Using source generation (AOT-compatible)
 34/// var provider = new Syringe()
 35///     .UsingSourceGen()
 36///     .BuildServiceProvider();
 37/// </code>
 38/// </example>
 39[DoNotAutoRegister]
 40public sealed record Syringe
 41{
 59042    internal ITypeRegistrar? TypeRegistrar { get; init; }
 59043    internal ITypeFilterer? TypeFilterer { get; init; }
 59044    internal IPluginFactory? PluginFactory { get; init; }
 59045    internal Func<ITypeRegistrar, ITypeFilterer, IPluginFactory, IServiceCollectionPopulator>? ServiceCollectionPopulato
 59046    internal IAssemblyProvider? AssemblyProvider { get; init; }
 59047    internal AssemblyOrdering.AssemblyOrderBuilder? AssemblyOrder { get; init; }
 59048    internal IReadOnlyList<Assembly>? AdditionalAssemblies { get; init; }
 59049    internal IReadOnlyList<Action<IServiceCollection>>? PreRegistrationCallbacks { get; init; }
 59050    internal IReadOnlyList<Action<IServiceCollection>>? PostPluginRegistrationCallbacks { get; init; }
 59051    internal VerificationOptions? VerificationOptions { get; init; }
 52
 53    /// <summary>
 54    /// Factory for creating <see cref="IServiceProviderBuilder"/> instances.
 55    /// </summary>
 59056    internal Func<IServiceCollectionPopulator, IAssemblyProvider, IReadOnlyList<Assembly>, IServiceProviderBuilder>? Ser
 57}