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