You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
796 B
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Microsoft.Extensions.DependencyInjection;
namespace DS.Module.Core.Attributes;
/// <summary>
/// 配置此特性将自动进行注入
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class DependencyAttribute : Attribute
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="lifetime">注入类型(Scoped\Singleton\Transient)</param>
public DependencyAttribute(ServiceLifetime lifetime)
{
Lifetime = lifetime;
}
/// <summary>
///
/// </summary>
public ServiceLifetime Lifetime { get; }
/// <summary>
/// 获取或设置 是否注册自身类型默认没有接口的类型会注册自身当此属性值为true时也会注册自身
/// </summary>
public bool AddSelf { get; set; }
}