using System;
namespace NCC.Dependency
{
///
/// 设置依赖注入方式
///
[SuppressSniffer, AttributeUsage(AttributeTargets.Class)]
public class InjectionAttribute : Attribute
{
///
/// 构造函数
///
///
public InjectionAttribute(params Type[] expectInterfaces)
{
Action = InjectionActions.Add;
Pattern = InjectionPatterns.All;
ExpectInterfaces = expectInterfaces ?? Array.Empty();
Order = 0;
}
///
/// 构造函数
///
///
///
public InjectionAttribute(InjectionActions action, params Type[] expectInterfaces)
{
Action = action;
Pattern = InjectionPatterns.All;
ExpectInterfaces = expectInterfaces ?? Array.Empty();
Order = 0;
}
///
/// 添加服务方式,存在不添加,或继续添加
///
public InjectionActions Action { get; set; }
///
/// 注册选项
///
public InjectionPatterns Pattern { get; set; }
///
/// 注册别名
///
/// 多服务时使用
public string Named { get; set; }
///
/// 排序,排序越大,则在后面注册
///
public int Order { get; set; }
///
/// 排除接口
///
public Type[] ExpectInterfaces { get; set; }
///
/// 代理类型,必须继承 DispatchProxy、IDispatchProxy
///
public Type Proxy { get; set; }
}
}