public class UseDIAttribute : Attribute
[UseDI(ServiceLifetime.Transient)]
public class MyService : xxx { }
[UseDI(typeof(xxx), typeof(yyy))]
public class MyService : xxx { }
[UseDI(ServiceLifetime.Transient, typeof(xxx))]
public class MyService : xxx { }
UseDIAttribute(Type[]) | 使用 Singleton 生命周期以及指定的服务类型初始化实例。 |
UseDIAttribute(ServiceLifetime, Type[]) | 使用指定的生命周期以及指定的服务类型初始化实例。 |
Public Properties | |
Lifetime | 获取要注册的服务的生命周期。 |
ServiceTypes | 获取要注册的服务类型数组。 |