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 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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, List<string> domains, string url, object defaults)
  9. {
  10. SubdomainRoute route = new SubdomainRoute(
  11. subDomains,
  12. domains,
  13. url,
  14. new RouteValueDictionary(defaults),
  15. new MvcRouteHandler());
  16. routes.Add(name, route);
  17. return route;
  18. }
  19. public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, List<string> domains, string url, object defaults, object constraints)
  20. {
  21. SubdomainRoute route = new SubdomainRoute(
  22. subDomains,
  23. domains,
  24. url,
  25. new RouteValueDictionary(defaults),
  26. new RouteValueDictionary(constraints),
  27. new MvcRouteHandler());
  28. routes.Add(name, route);
  29. return route;
  30. }
  31. public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, List<string> domains, string area, string url, object defaults, string[] namespaces)
  32. {
  33. SubdomainRoute route = new SubdomainRoute(
  34. subDomains,
  35. domains,
  36. url,
  37. new RouteValueDictionary(defaults),
  38. new RouteValueDictionary(new { }),
  39. new RouteValueDictionary(new { Area = area, Namespaces = namespaces }),
  40. new MvcRouteHandler());
  41. routes.Add(name, route);
  42. return route;
  43. }
  44. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults)
  45. {
  46. SubdomainRoute route = new SubdomainRoute(
  47. subDomains,
  48. domains,
  49. url,
  50. new RouteValueDictionary(defaults),
  51. new RouteValueDictionary(new {}),
  52. new RouteValueDictionary(new {Area = context.AreaName}),
  53. new MvcRouteHandler());
  54. context.Routes.Add(name, route);
  55. return route;
  56. }
  57. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults, object constraints)
  58. {
  59. SubdomainRoute route = new SubdomainRoute(
  60. subDomains,
  61. domains,
  62. url,
  63. new RouteValueDictionary(defaults),
  64. new RouteValueDictionary(constraints),
  65. new RouteValueDictionary(new {Area = context.AreaName}),
  66. new MvcRouteHandler());
  67. context.Routes.Add(name, route);
  68. return route;
  69. }
  70. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults, string[] namespaces)
  71. {
  72. SubdomainRoute route = new SubdomainRoute(
  73. subDomains,
  74. domains,
  75. url,
  76. new RouteValueDictionary(defaults),
  77. new RouteValueDictionary(new {}),
  78. new RouteValueDictionary(new { Area = context.AreaName, Namespaces = namespaces }),
  79. new MvcRouteHandler());
  80. context.Routes.Add(name, route);
  81. return route;
  82. }
  83. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults, object constraints, string[] namespaces)
  84. {
  85. SubdomainRoute route = new SubdomainRoute(
  86. subDomains,
  87. domains,
  88. url,
  89. new RouteValueDictionary(defaults),
  90. new RouteValueDictionary(constraints),
  91. new RouteValueDictionary(new { Area = context.AreaName, Namespaces = namespaces }),
  92. new MvcRouteHandler());
  93. context.Routes.Add(name, route);
  94. return route;
  95. }
  96. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, string area, object defaults)
  97. {
  98. SubdomainRoute route = new SubdomainRoute(
  99. subDomains,
  100. domains,
  101. url,
  102. new RouteValueDictionary(defaults),
  103. new RouteValueDictionary(new { }),
  104. new RouteValueDictionary(new { Area = area }),
  105. new MvcRouteHandler());
  106. context.Routes.Add(name, route);
  107. return route;
  108. }
  109. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, string area, object defaults, object constraints)
  110. {
  111. SubdomainRoute route = new SubdomainRoute(
  112. subDomains,
  113. domains,
  114. url,
  115. new RouteValueDictionary(defaults),
  116. new RouteValueDictionary(constraints),
  117. new RouteValueDictionary(new { Area = area }),
  118. new MvcRouteHandler());
  119. context.Routes.Add(name, route);
  120. return route;
  121. }
  122. public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, string area, object defaults, string[] namespaces)
  123. {
  124. SubdomainRoute route = new SubdomainRoute(
  125. subDomains,
  126. domains,
  127. url,
  128. new RouteValueDictionary(defaults),
  129. new RouteValueDictionary(new { }),
  130. new RouteValueDictionary(new { Area = area, Namespaces = namespaces }),
  131. new MvcRouteHandler());
  132. context.Routes.Add(name, route);
  133. return route;
  134. }
  135. }
  136. }