ModuleItem.cs 755 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 string ModuleName {
  29. get {
  30. return _name;
  31. }
  32. }
  33. }
  34. }