Skip to content

Commit

Permalink
Tinyweb now supports 'areas' as a less duplicative way of defining mu…
Browse files Browse the repository at this point in the history
…ltiple handlers under a common name using the class namespace - courtesy of Matt Burton
  • Loading branch information
Martin Rue committed Aug 9, 2011
1 parent eb39cbc commit 24ca631
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -118,6 +118,8 @@ You can see the live build status (and grab the binary releases) from the [build

Many thanks to the following people who have contributed to Tinyweb:

* [Matt Burton](https://github.com/mattburton)

* [Ben Dornis](https://github.com/Buildstarted)

* [Tom Bell](https://github.com/tombell)
Expand Up @@ -97,10 +97,10 @@ private string getRouteUriByConvention(Type type)

private string addHandlerAreaToRouteUriIfRegistered(Type handlerType, string routeUri)
{
var handlerNamespace = handlerType.Namespace ?? "";
var handlerNamespace = handlerType.Namespace ?? string.Empty;
var handlerArea = Tinyweb.Areas.ContainsKey(handlerNamespace) ? Tinyweb.Areas[handlerNamespace] : null;

if (string.IsNullOrEmpty(handlerArea) || handlerArea.Equals(routeUri))
if (handlerArea.IsEmpty() || handlerArea == routeUri)
{
return routeUri;
}
Expand Down
3 changes: 1 addition & 2 deletions src/tinyweb.framework/Init/Tinyweb.cs
@@ -1,5 +1,4 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -37,7 +36,7 @@ public static int Init(params Registry[] registries)

public static void RegisterArea(string area, string areaNamespace)
{
Areas.Add(areaNamespace, area);
Areas.Add(areaNamespace, area.ToLower());
}

public static string WhatHaveIGot()
Expand Down

0 comments on commit 24ca631

Please sign in to comment.