PageRenderTime 11ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/src/LinFu.IoC.Common/FactoryAttribute.cs

http://github.com/philiplaureano/LinFu
C# | 39 lines | 15 code | 4 blank | 20 comment | 0 complexity | cc197604954bd4b1543d5818364c6143 MD5 | raw file
  1. using System;
  2. namespace LinFu.IoC.Configuration
  3. {
  4. /// <summary>
  5. /// An attribute that marks a type as a custom factory.
  6. /// </summary>
  7. [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  8. public class FactoryAttribute : Attribute
  9. {
  10. /// <summary>
  11. /// The additional parameters supported by the custom factory.
  12. /// </summary>
  13. public Type[] ArgumentTypes;
  14. /// <summary>
  15. /// The service name that will be associated
  16. /// with the service type.
  17. /// </summary>
  18. public string ServiceName;
  19. /// <summary>
  20. /// Marks a target type as a custom factory
  21. /// that can create object instances that
  22. /// can implement the <paramref name="serviceType" />.
  23. /// </summary>
  24. /// <param name="serviceType">The service type to create.</param>
  25. public FactoryAttribute(Type serviceType)
  26. {
  27. ServiceType = serviceType;
  28. }
  29. /// <summary>
  30. /// Gets the service type that can be created
  31. /// using the factory instance.
  32. /// </summary>
  33. public Type ServiceType { get; }
  34. }
  35. }