using Microsoft.Extensions.DependencyInjection; using System; using System.Diagnostics.CodeAnalysis; namespace Hast.Common.Interfaces; /// /// Base interface for services that are instantiated per unit of work (i.e. web request). /// [SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Necessary for the automatic dependency registration.")] public interface IDependency { } /// /// Base interface for services that are instantiated per shell/tenant. /// [SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Necessary for the automatic dependency registration.")] public interface ISingletonDependency : IDependency { } /// /// Base interface for services that are instantiated per usage. /// [SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Necessary for the automatic dependency registration.")] public interface ITransientDependency : IDependency { } /// /// Indicates that the has its own initializer which should be invoked right before the /// service is added to the . /// [AttributeUsage(AttributeTargets.Class)] public sealed class DependencyInitializerAttribute : Attribute { /// /// Gets the name of the public static method which will be invoked. /// public string MemberName { get; } /// /// The name of a public static method that takes one argument and returns void. /// public DependencyInitializerAttribute(string memberName) => MemberName = memberName; }