Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#57 - testing nuget packages and making some modifications to allow f…
…ull plug-and-chug (ie: no missing imports, etc).
- Loading branch information
Showing
12 changed files
with
96 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
src/AttributeRouting.Web.Http.SelfHost/AttributeRouting.cs.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 59 additions & 59 deletions
118
src/AttributeRouting.Web.Http.SelfHost/HttpRouteCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Web.Http; | ||
using System.Web.Http.Routing; | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Web.Http; | ||
using System.Web.Http.Routing; | ||
using AttributeRouting.Framework; | ||
|
||
namespace AttributeRouting.Web.Http.SelfHost | ||
{ | ||
/// <summary> | ||
/// Extensions to the HttpRouteCollection | ||
/// </summary> | ||
public static class HttpRouteCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Scans the calling assembly for all routes defined with AttributeRouting attributes, | ||
/// using the default conventions. | ||
/// </summary> | ||
public static void MapHttpAttributeRoutes(this HttpRouteCollection routes) | ||
{ | ||
var configuration = new HttpAttributeRoutingConfiguration(); | ||
configuration.ScanAssembly(Assembly.GetCallingAssembly()); | ||
|
||
routes.MapHttpAttributeRoutesInternal(configuration); | ||
} | ||
|
||
/// <summary> | ||
/// Scans the specified assemblies for all routes defined with AttributeRouting attributes, | ||
/// and applies configuration options against the routes found. | ||
/// </summary> | ||
/// <param name="routes"></param> | ||
/// <param name="configurationAction"> | ||
/// The initialization action that builds the configuration object. | ||
/// </param> | ||
public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, Action<HttpAttributeRoutingConfiguration> configurationAction) | ||
{ | ||
var configuration = new HttpAttributeRoutingConfiguration(); | ||
configurationAction.Invoke(configuration); | ||
|
||
routes.MapHttpAttributeRoutesInternal(configuration); | ||
} | ||
|
||
/// <summary> | ||
/// Scans the specified assemblies for all routes defined with AttributeRouting attributes, | ||
/// and applies configuration options against the routes found. | ||
/// </summary> | ||
/// <param name="configuration"> | ||
/// The configuration object. | ||
/// </param> | ||
public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, HttpAttributeRoutingConfiguration configuration) | ||
{ | ||
routes.MapHttpAttributeRoutesInternal(configuration); | ||
} | ||
|
||
private static void MapHttpAttributeRoutesInternal(this HttpRouteCollection routes, HttpAttributeRoutingConfiguration configuration) | ||
{ | ||
var generatedRoutes = new RouteBuilder(configuration).BuildAllRoutes(); | ||
|
||
generatedRoutes.ToList().ForEach(r => routes.Add(r.RouteName, (HttpRoute)r)); | ||
} | ||
} | ||
namespace AttributeRouting.Web.Http.SelfHost | ||
{ | ||
/// <summary> | ||
/// Extensions to the HttpRouteCollection | ||
/// </summary> | ||
public static class HttpRouteCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Scans the calling assembly for all routes defined with AttributeRouting attributes, | ||
/// using the default conventions. | ||
/// </summary> | ||
public static void MapHttpAttributeRoutes(this HttpRouteCollection routes) | ||
{ | ||
var configuration = new HttpAttributeRoutingConfiguration(); | ||
configuration.ScanAssembly(Assembly.GetCallingAssembly()); | ||
|
||
routes.MapHttpAttributeRoutesInternal(configuration); | ||
} | ||
|
||
/// <summary> | ||
/// Scans the specified assemblies for all routes defined with AttributeRouting attributes, | ||
/// and applies configuration options against the routes found. | ||
/// </summary> | ||
/// <param name="routes"></param> | ||
/// <param name="configurationAction"> | ||
/// The initialization action that builds the configuration object. | ||
/// </param> | ||
public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, Action<HttpAttributeRoutingConfiguration> configurationAction) | ||
{ | ||
var configuration = new HttpAttributeRoutingConfiguration(); | ||
configurationAction.Invoke(configuration); | ||
routes.MapHttpAttributeRoutesInternal(configuration); | ||
} | ||
|
||
/// <summary> | ||
/// Scans the specified assemblies for all routes defined with AttributeRouting attributes, | ||
/// and applies configuration options against the routes found. | ||
/// </summary> | ||
/// <param name="configuration"> | ||
/// The configuration object. | ||
/// </param> | ||
public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, HttpAttributeRoutingConfiguration configuration) | ||
{ | ||
routes.MapHttpAttributeRoutesInternal(configuration); | ||
} | ||
|
||
private static void MapHttpAttributeRoutesInternal(this HttpRouteCollection routes, HttpAttributeRoutingConfiguration configuration) | ||
{ | ||
var generatedRoutes = new RouteBuilder(configuration).BuildAllRoutes(); | ||
|
||
generatedRoutes.ToList().ForEach(r => routes.Add(r.RouteName, (HttpRoute)r)); | ||
} | ||
} | ||
} |
6 changes: 2 additions & 4 deletions
6
src/AttributeRouting.Web.Http.WebHost/AttributeRoutingHttp.cs.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters