2
0

ModuleItem.cs 859 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // System.Web.Configuration.ModuleItem
  3. //
  4. // Author:
  5. // Patrik Torstensson ([email protected])
  6. //
  7. using System;
  8. namespace System.Web.Configuration {
  9. public class ModuleItem {
  10. private Type _type;
  11. private string _typeName;
  12. private string _name;
  13. public ModuleItem(string name, string type) {
  14. _typeName = type;
  15. _name = name;
  16. _type = Type.GetType (type, true);
  17. if (!typeof(IHttpModule).IsAssignableFrom(_type))
  18. throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
  19. }
  20. public IHttpModule Create() {
  21. return (IHttpModule) HttpRuntime.CreateInternalObject(_type);
  22. }
  23. public Type Type {
  24. get {
  25. return _type;
  26. }
  27. }
  28. public bool IsMatch (string name)
  29. {
  30. return (_type.Name == name || _type.FullName == name);
  31. }
  32. public string ModuleName {
  33. get {
  34. return _name;
  35. }
  36. }
  37. }
  38. }