The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SubdomainRouteExtension.cs 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Routing;
  4. namespace Teknik
  5. {
  6. public static class SubdomainRouteExtension
  7. {
  8. public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, string url, object defaults)
  9. {
  10. SubdomainRoute route = new SubdomainRoute(
  11. subDomains,
  12. url,
  13. new RouteValueDictionary(defaults),
  14. new MvcRouteHandler());
  15. routes.Add(name, route);
  16. return route;
  17. }
  18. public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, string url, object defaults, object constraints)
  19. {
  20. SubdomainRoute route = new SubdomainRoute(
  21. subDomains,
  22. url,
  23. new RouteValueDictionary(defaults),
  24. new RouteValueDictionary(constraints),
  25. new MvcRouteHandler());
  26. routes.Add(name, route);
  27. return route;
  28. }
  29. public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, string area, string url, object defaults, string[] namespaces)
  30. {
  31. SubdomainRoute route = new SubdomainRoute(
  32. subDomains,
  33. url,
  34. new RouteValueDictionary(defaults),
  35. new RouteValueDictionary(new { }),
  36. new RouteValueDictionary(new { Area = area, Namespaces = namespaces }),
  37. new MvcRouteHandler());
  38. routes.Add(name, route);
  39. return route;
  40. }
  41. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, object defaults)
  42. {
  43. SubdomainRoute route = new SubdomainRoute(
  44. subDomains,
  45. url,
  46. new RouteValueDictionary(defaults),
  47. new RouteValueDictionary(new {}),
  48. new RouteValueDictionary(new {Area = context.AreaName}),
  49. new MvcRouteHandler());
  50. context.Routes.Add(name, route);
  51. return route;
  52. }
  53. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, object defaults, object constraints)
  54. {
  55. SubdomainRoute route = new SubdomainRoute(
  56. subDomains,
  57. url,
  58. new RouteValueDictionary(defaults),
  59. new RouteValueDictionary(constraints),
  60. new RouteValueDictionary(new {Area = context.AreaName}),
  61. new MvcRouteHandler());
  62. context.Routes.Add(name, route);
  63. return route;
  64. }
  65. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, object defaults, string[] namespaces)
  66. {
  67. SubdomainRoute route = new SubdomainRoute(
  68. subDomains,
  69. url,
  70. new RouteValueDictionary(defaults),
  71. new RouteValueDictionary(new {}),
  72. new RouteValueDictionary(new { Area = context.AreaName, Namespaces = namespaces }),
  73. new MvcRouteHandler());
  74. context.Routes.Add(name, route);
  75. return route;
  76. }
  77. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, string area, object defaults)
  78. {
  79. SubdomainRoute route = new SubdomainRoute(
  80. subDomains,
  81. url,
  82. new RouteValueDictionary(defaults),
  83. new RouteValueDictionary(new { }),
  84. new RouteValueDictionary(new { Area = area }),
  85. new MvcRouteHandler());
  86. context.Routes.Add(name, route);
  87. return route;
  88. }
  89. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, string area, object defaults, object constraints)
  90. {
  91. SubdomainRoute route = new SubdomainRoute(
  92. subDomains,
  93. url,
  94. new RouteValueDictionary(defaults),
  95. new RouteValueDictionary(constraints),
  96. new RouteValueDictionary(new { Area = area }),
  97. new MvcRouteHandler());
  98. context.Routes.Add(name, route);
  99. return route;
  100. }
  101. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, string area, object defaults, string[] namespaces)
  102. {
  103. SubdomainRoute route = new SubdomainRoute(
  104. subDomains,
  105. url,
  106. new RouteValueDictionary(defaults),
  107. new RouteValueDictionary(new { }),
  108. new RouteValueDictionary(new { Area = area, Namespaces = namespaces }),
  109. new MvcRouteHandler());
  110. context.Routes.Add(name, route);
  111. return route;
  112. }
  113. }
  114. }