DiImplementsOfAttribute.cs 787 B

1234567891011121314151617181920212223
  1. using System;
  2. namespace Quadarax.Foundation.Core.Attributes
  3. {
  4. [AttributeUsage(AttributeTargets.Class,AllowMultiple = true)]
  5. public class DiImplementsOfAttribute : Attribute
  6. {
  7. public Type InterfaceTypeImplementing { get; }
  8. public LifeCycleTypeEnum LifeCycleType { get; }
  9. public DiImplementsOfAttribute(Type interfaceType, LifeCycleTypeEnum lifeCycleType)
  10. {
  11. if (interfaceType == null)
  12. throw new ArgumentNullException(nameof(interfaceType));
  13. if (!interfaceType.IsInterface)
  14. throw new ArgumentException("DiImplementsOf expects interface type", nameof(interfaceType));
  15. LifeCycleType = lifeCycleType;
  16. InterfaceTypeImplementing = interfaceType;
  17. }
  18. }
  19. }