AbpModuleInfo.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Reflection;
  4. using JetBrains.Annotations;
  5. namespace Abp.Modules
  6. {
  7. /// <summary>
  8. /// Used to store all needed information for a module.
  9. /// </summary>
  10. public class AbpModuleInfo
  11. {
  12. /// <summary>
  13. /// The assembly which contains the module definition.
  14. /// </summary>
  15. public Assembly Assembly { get; }
  16. /// <summary>
  17. /// Type of the module.
  18. /// </summary>
  19. public Type Type { get; }
  20. /// <summary>
  21. /// Instance of the module.
  22. /// </summary>
  23. public AbpModule Instance { get; }
  24. /// <summary>
  25. /// Is this module loaded as a plugin.
  26. /// </summary>
  27. public bool IsLoadedAsPlugIn { get; }
  28. /// <summary>
  29. /// All dependent modules of this module.
  30. /// </summary>
  31. public List<AbpModuleInfo> Dependencies { get; }
  32. /// <summary>
  33. /// Creates a new AbpModuleInfo object.
  34. /// </summary>
  35. public AbpModuleInfo([NotNull] Type type, [NotNull] AbpModule instance, bool isLoadedAsPlugIn)
  36. {
  37. Check.NotNull(type, nameof(type));
  38. Check.NotNull(instance, nameof(instance));
  39. Type = type;
  40. Instance = instance;
  41. IsLoadedAsPlugIn = isLoadedAsPlugIn;
  42. Assembly = Type.GetTypeInfo().Assembly;
  43. Dependencies = new List<AbpModuleInfo>();
  44. }
  45. public override string ToString()
  46. {
  47. return Type.AssemblyQualifiedName ??
  48. Type.FullName;
  49. }
  50. }
  51. }