up
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace StellaOps.DependencyInjection;
|
||||
|
||||
public interface IDependencyInjectionRoutine
|
||||
{
|
||||
IServiceCollection Register(
|
||||
IServiceCollection services,
|
||||
IConfiguration configuration);
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace StellaOps.DependencyInjection;
|
||||
|
||||
public interface IDependencyInjectionRoutine
|
||||
{
|
||||
IServiceCollection Register(
|
||||
IServiceCollection services,
|
||||
IConfiguration configuration);
|
||||
}
|
||||
@@ -1,64 +1,64 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace StellaOps.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Declares how a plug-in type should be registered with the host dependency injection container.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class ServiceBindingAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as itself with a singleton lifetime.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute()
|
||||
: this(null, ServiceLifetime.Singleton)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as itself with the specified lifetime.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute(ServiceLifetime lifetime)
|
||||
: this(null, lifetime)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as the specified service type with a singleton lifetime.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute(Type serviceType)
|
||||
: this(serviceType, ServiceLifetime.Singleton)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as the specified service type.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute(Type? serviceType, ServiceLifetime lifetime)
|
||||
{
|
||||
ServiceType = serviceType;
|
||||
Lifetime = lifetime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The service contract that should resolve to the decorated implementation. When <c>null</c>, the implementation registers itself.
|
||||
/// </summary>
|
||||
public Type? ServiceType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The lifetime that should be used when registering the decorated implementation.
|
||||
/// </summary>
|
||||
public ServiceLifetime Lifetime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether existing descriptors for the same service type should be removed before this binding is applied.
|
||||
/// </summary>
|
||||
public bool ReplaceExisting { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// When true, the implementation is also registered as itself even if a service type is specified.
|
||||
/// </summary>
|
||||
public bool RegisterAsSelf { get; init; }
|
||||
}
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace StellaOps.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Declares how a plug-in type should be registered with the host dependency injection container.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class ServiceBindingAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as itself with a singleton lifetime.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute()
|
||||
: this(null, ServiceLifetime.Singleton)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as itself with the specified lifetime.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute(ServiceLifetime lifetime)
|
||||
: this(null, lifetime)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as the specified service type with a singleton lifetime.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute(Type serviceType)
|
||||
: this(serviceType, ServiceLifetime.Singleton)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a binding that registers the decorated type as the specified service type.
|
||||
/// </summary>
|
||||
public ServiceBindingAttribute(Type? serviceType, ServiceLifetime lifetime)
|
||||
{
|
||||
ServiceType = serviceType;
|
||||
Lifetime = lifetime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The service contract that should resolve to the decorated implementation. When <c>null</c>, the implementation registers itself.
|
||||
/// </summary>
|
||||
public Type? ServiceType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The lifetime that should be used when registering the decorated implementation.
|
||||
/// </summary>
|
||||
public ServiceLifetime Lifetime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether existing descriptors for the same service type should be removed before this binding is applied.
|
||||
/// </summary>
|
||||
public bool ReplaceExisting { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// When true, the implementation is also registered as itself even if a service type is specified.
|
||||
/// </summary>
|
||||
public bool RegisterAsSelf { get; init; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user