AutoInjectAttribute.cs 733 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. namespace NXWMS.Model.Common
  6. {
  7. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
  8. public class AutoInjectAttribute : Attribute
  9. {
  10. public AutoInjectAttribute(Type interfaceType, InjectType injectType)
  11. {
  12. Type = interfaceType;
  13. InjectType = injectType;
  14. }
  15. public Type Type { get; set; }
  16. /// <summary>
  17. /// 注入类型
  18. /// </summary>
  19. public InjectType InjectType { get; set; }
  20. }
  21. /// <summary>
  22. /// 依赖注入类型
  23. /// </summary>
  24. public enum InjectType
  25. {
  26. Scope,
  27. Single,
  28. Transient
  29. }
  30. }