Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small usability improvements regarding instantiating a UriMaker. #14

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
#---------------------------------#

# version format
version: 0.5.0-beta{build}
version: 0.5.1-beta{build}

#---------------------------------#
# environment configuration #
5 changes: 5 additions & 0 deletions src/Drum/HttpRequestExtensions.cs
Original file line number Diff line number Diff line change
@@ -9,5 +9,10 @@ public static UriMaker<T> TryGetUriMakerFor<T>(this HttpRequestMessage req)
var context = req.GetConfiguration().TryGetUriMakerContext();
return context != null ? context.NewUriMakerFor<T>(req) : null;
}

public static UriMaker<TController> TryGetUriMaker<TController>(this TController controller, HttpRequestMessage req)
{
return req.TryGetUriMakerFor<TController>();
}
}
}
4 changes: 2 additions & 2 deletions src/Drum/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyVersion("0.5.1.*")]
[assembly: AssemblyInformationalVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.1.0")]
13 changes: 5 additions & 8 deletions src/Drum/UriMaker.cs
Original file line number Diff line number Diff line change
@@ -50,24 +50,21 @@ private Uri CoreUriFor(Expression expr)
}
}

public class UriMaker<TController>
public class UriMaker<TController> : UriMaker
{
private readonly UriMaker _uriMaker;

public Uri UriFor(Expression<Action<TController>> action)
{
return _uriMaker.UriFor(action);
return base.UriFor(action);
}

public Uri UriFor(Expression<Func<TController, object>> action)
{
return _uriMaker.UriFor(action);
return base.UriFor(action);
}

public UriMaker(Func<MethodInfo, MethodHandler> mapper, UrlHelper urlHelper)
{
_uriMaker = new UriMaker(mapper, urlHelper);
}
: base(mapper, urlHelper)
{}

public UriMaker(UriMakerContext fact, HttpRequestMessage req)
: this(fact.RouteMap, new UrlHelper(req))