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

Add Web API support for both WebHost and SelfHost scenarios #57

Closed
wants to merge 51 commits into from

Conversation

kamranayub
Copy link
Contributor

This is a massive change, or at least it is in terms of organization. Core code really hasn't changed. There are specs for Web API with the feature files finished, but tests are missing for all the other standard unit tests (Translations, notably).

You don't need to pull this in right now, rather I want to keep this open to track changes and discuss them. I've tried to keep the structure mostly the same as it was before, and hopefully most of the changes make sense.

Major Changes

Namespacing

It looks like there's a ton of projects, and there are, but it's mostly to keep with the ASP.NET web stack convention and to implement derived classes that simply implement the proper framework interfaces.

Projects

Quick rundown, but each should be self-explanatory:

  • AttributeRouting - Core library, no web dependencies whatsoever
  • AttributeRouting.Web - Core web library, dependencies on System.Web and System.Web.Routing. This is the base for MVC and ASP.NET Web API (not self-host).
  • AttributeRouting.Web.Http - Stores conventions for Web API to be shared between WebHost and SelfHost
  • AttributeRouting.Web.Http.SelfHost - Self-host specific derived classes for Web API
  • AttributeRouting.Web.Http.WebHost - Web-host specific derived classes for ASP.NET Web API
  • AttributeRouting.Web.Mvc - ASP.NET MVC specific derived classes

The main reason I decoupled everything was for ease of downstream consumption. If I'm doing a MVC project, I don't want Web API DLLs in my project. If I'm doing only ASP.NET Web API, I don't want MVC stuff in my project. If I'm writing a Web API console app, I don't need web stuff. This just keeps everything nice and separated, no un-needed dependencies.

Http Convention

For most of the Web API-specific stuff, I prefix everything with Http to keep in line with what MS is doing. So it is HttpAttributeRoutingConfiguration and MapHttpAttributeRoutes. This makes it easier to use MVC and Web API at the same time, which will probably be the most common.

Minor Changes

  • There's been some abstraction of certain things like creating AR attributes, constraints, and URL parameters. These have interfaces in AttributeRouting.Framework.Factories and have implementations in the 3 projects.
  • Dependent Nuget packages have been updated to latest versions.
  • Specs have been added to test web host Web API.
  • Added extra web.config transform for IIS and IIS Express (system.webServer) to handle routes.axd
  • Nu-transform files are in the projects for easier maintainability

Web API portion has not been tested yet
This contains the logic so it only needs to be in one place
It turns out the System.Web.Http.WebHost package already takes care of
converting WebAPI attributes and crap into System.Web.Routing-compatible
types. All the work I did was not lost, it will help support a Self
hosted WebAPI solution too. Plus, the separation allows more flexibility.
Basic test of an API controller shows the correct routes.
This will let people use the default matching Web API provides,
{controller}/{id} based on method names.
Also reorganized LogWriter so it used AttributeRouteInfo
Use non-generic IRouteConvention to clean up API for WebAPI conventions
Follow the same convention MS does. Web, Web.Mvc, Http, etc. Moved all
publicly consumable constraints, conventions, and attributes to the root
project namespaces.
Added in some logic the runtime also uses to determine valid actions.
Renamed to "DefaultHttpRouteConvention" so it's more clear what it does.
TController didn't need to actually be on it; that is only used in
TranslationBuilder. Added localized API controller.
Forgot to save sln
This simplifies a lot of code, removing need for derived fluent
translation providers. Slowly but surely.
This makes keeping version information consistent for Nuget and to help
with maintenance.
AttributeRouting.Http -> AttributeRouting.Web.Http to match convention
used by ASP.NET Web Stack
Also fixed an issue where the MVC-based config was accepting promoted
controllers of the Api controller types
@mccalltd
Copy link
Owner

mccalltd commented Apr 7, 2012

Talk about taking ownership! Thanks for the long description of the changes. This will definitely be v2. I'll take a look soon, but might have to wait until next week (what with Easter holiday and traveling). Again, this is awesome -- radical rethinking, and the impl to back it up. You rock.

t

On Apr 7, 2012, at 12:30 AM, Kamran Ayub wrote:

This is a massive change, or at least it is in terms of organization. Core code really hasn't changed. There are specs for Web API with the feature files finished, but tests are missing for all the other standard unit tests (Translations, notably).

You don't need to pull this in right now, rather I want to keep this open to track changes and discuss them. I've tried to keep the structure mostly the same as it was before, and hopefully most of the changes make sense.

Major Changes

Generics

The biggest change has been the switch to generics for most of the core framework classes; bubbling up to the entry point: configuration. In order to keep the generic ugliness out of client code, I've implemented derived classes for each of the 3 frameworks: Mvc, WebHost, and SelfHost. These contain hardly any logic, they are there for a clean veneer over the underlying API.

I am working to reduce the need for generics, so we'll see how far I can get. I had an idea of using a Pipeline architecture perhaps, where it may be possible to define 3 pipelines for handling core logic, and letting the 3 frameworks implement the correct attributes (because they must implement the correct interfaces for the frameworks: IRouteConstraint in MVC, IHttpRouteConstraint for Web API). WebHost is significantly easier to integrate with the core of AR, because it only requires two different types: IHttpController and RouteParameter.

Namespacing

It looks like there's a ton of projects, and there are, but it's mostly to keep with the ASP.NET web stack convention and to implement derived classes that simply implement the proper framework interfaces.

Attributes

Unfortunately, there's no getting around being forced to create derived attributes for each framework because Web API and MVC have different interfaces they look for. I tried to keep the base logic in both AttributeRouting and AttributeRouting.Web.

Projects

Quick rundown, but each should be self-explanatory:

  • AttributeRouting - Core library, no web dependencies whatsoever
  • AttributeRouting.Web - Core web library, dependencies on System.Web and System.Web.Routing. This is the base for MVC and ASP.NET Web API (not self-host).
  • AttributeRouting.Web.Http - Core HTTP library for self-hosted and web-hosted Web API projects
  • AttributeRouting.Web.Http.SelfHost - Self-host specific derived classes for Web API
  • AttributeRouting.Web.Http.WebHost - Web-host specific derived classes for ASP.NET Web API
  • AttributeRouting.Web.Mvc - ASP.NET MVC specific derived classes

The main reason I decoupled everything was for ease of downstream consumption. If I'm doing a MVC project, I don't want Web API DLLs in my project. If I'm doing only ASP.NET Web API, I don't want MVC stuff in my project. If I'm writing a Web API console app, I don't need web stuff. This just keeps everything nice and separated, no un-needed dependencies.

Http Convention

For most of the Web API-specific stuff, I prefix everything with Http to keep in line with what MS is doing. So it is HttpAttributeRoutingConfiguration and MapHttpAttributeRoutes. This makes it easier to use MVC and Web API at the same time, which will probably be the most common.

Some things are not prefixed with Http. All the standard HTTP methods aren't: GET, POST, PUT, DELETE, OPTIONS, TRACE. I am not sure if this is OK, it feels weird to make them prefixed and hopefully people will not accidentally use MVC namespaces in their ApiControllers.

You can merge this Pull Request by running:

git pull https://github.com/kamranayub/AttributeRouting web-api

Or you can view, comment on it, or merge it online at:

#57

-- Commit Summary --

  • Enable Nuget package restore
  • Ignore packages dir
  • AttributeRouting project build succeeds
  • All tests pass; MVC works as expected
  • Need to fix virtual path and abstract current ui culture resolver
  • Fix line endings (GH for Windows)
  • Everything builds successfully
  • Finished port, all tests pass, solution builds
  • Simplified constraints using abstract base classes
  • Simplify logging
  • Reorganized solution (see notes)
  • Added HttpRouteConvention
  • Added SelfHost test console app
  • Clean up conventions for Http
  • Clean up namespaces and project names
  • Clean up Web API default route convention
  • Remove unused namespaces
  • Fix up FluentTranslationProvider
  • Commit proj changes
  • Removed need for TConstraint from IRouteConstraint
  • Added SharedAssemblyInfo
  • Another fix to the namespaces
  • Add AreaConfigurations for Web, WebHost, and SelfHost
  • Add specs for Web API: Conventions, Constraints, and StandardUsage
  • RouteDefaults specs for Web API
  • RouteConvention spec fix and RoutePrecedence specs
  • Web API RoutePrefixes specs

-- File Changes --

M .gitignore (3)
A src/.nuget/NuGet.Config (6)
A src/.nuget/NuGet.exe (0)
A src/.nuget/NuGet.targets (71)
M src/AttributeRouting.Specs/AttributeRouting.Specs.csproj (421)
M src/AttributeRouting.Specs/Extensions.cs (2)
M src/AttributeRouting.Specs/Features/Logging.feature.cs (29)
M src/AttributeRouting.Specs/Features/RouteAreas.feature (19)
M src/AttributeRouting.Specs/Features/RouteAreas.feature.cs (118)
M src/AttributeRouting.Specs/Features/RouteConstraints.feature (6)
M src/AttributeRouting.Specs/Features/RouteConstraints.feature.cs (75)
M src/AttributeRouting.Specs/Features/RouteConventions.feature (44)
M src/AttributeRouting.Specs/Features/RouteConventions.feature.cs (305)
M src/AttributeRouting.Specs/Features/RouteDefaults.feature (6)
M src/AttributeRouting.Specs/Features/RouteDefaults.feature.cs (87)
M src/AttributeRouting.Specs/Features/RoutePrecedence.feature (34)
M src/AttributeRouting.Specs/Features/RoutePrecedence.feature.cs (152)
M src/AttributeRouting.Specs/Features/RoutePrefixes.feature (16)
M src/AttributeRouting.Specs/Features/RoutePrefixes.feature.cs (123)
M src/AttributeRouting.Specs/Features/StandardUsage.feature (20)
M src/AttributeRouting.Specs/Features/StandardUsage.feature.cs (65)
M src/AttributeRouting.Specs/ScenarioContextExtensions.cs (17)
M src/AttributeRouting.Specs/Steps/LoggingSteps.cs (5)
M src/AttributeRouting.Specs/Steps/RouteConstraintSteps.cs (29)
M src/AttributeRouting.Specs/Steps/RouteDefaultsSteps.cs (22)
M src/AttributeRouting.Specs/Steps/RoutePrecedenceSteps.cs (14)
M src/AttributeRouting.Specs/Steps/SharedSteps.cs (3)
M src/AttributeRouting.Specs/Steps/StandardUsageSteps.cs (1)
M src/AttributeRouting.Specs/Subjects/BugFixesController.cs (31)
A src/AttributeRouting.Specs/Subjects/Http/RouteAreasControllers.cs (49)
A src/AttributeRouting.Specs/Subjects/Http/RouteConstraintsController.cs (31)
A src/AttributeRouting.Specs/Subjects/Http/RouteConventionsController.cs (84)
A src/AttributeRouting.Specs/Subjects/Http/RouteDefaultsController.cs (36)
A src/AttributeRouting.Specs/Subjects/Http/RoutePrecedenceController.cs (87)
A src/AttributeRouting.Specs/Subjects/Http/RoutePrefixesControllers.cs (56)
A src/AttributeRouting.Specs/Subjects/Http/StandardUsageController.cs (45)
M src/AttributeRouting.Specs/Subjects/LocalizationControllers.cs (93)
M src/AttributeRouting.Specs/Subjects/LowercaseUrlController.cs (29)
M src/AttributeRouting.Specs/Subjects/RouteAreasControllers.cs (1)
M src/AttributeRouting.Specs/Subjects/RouteConstraintsController.cs (2)
M src/AttributeRouting.Specs/Subjects/RouteConventionsController.cs (1)
M src/AttributeRouting.Specs/Subjects/RouteDefaultsController.cs (1)
M src/AttributeRouting.Specs/Subjects/RoutePrecedenceController.cs (1)
M src/AttributeRouting.Specs/Subjects/RoutePrefixesControllers.cs (1)
M src/AttributeRouting.Specs/Subjects/StandardUsageController.cs (1)
M src/AttributeRouting.Specs/Subjects/SubdomainControllers.cs (49)
M src/AttributeRouting.Specs/Tests/BugFixTests.cs (149)
M src/AttributeRouting.Specs/Tests/Localization/AttributeRouteTests.cs (357)
M src/AttributeRouting.Specs/Tests/Localization/FluentTranslationProviderTests.cs (150)
M src/AttributeRouting.Specs/Tests/Localization/RouteBuilderTests.cs (243)
M src/AttributeRouting.Specs/Tests/Localization/UrlHelperTests.cs (145)
M src/AttributeRouting.Specs/Tests/LowercaseUrls/AttributeRouteTests.cs (134)
M src/AttributeRouting.Specs/Tests/LowercaseUrls/RouteBuilderTests.cs (91)
M src/AttributeRouting.Specs/Tests/Subdomains/AttributeRouteTests.cs (143)
M src/AttributeRouting.Specs/Tests/Subdomains/RouteBuilderTests.cs (52)
M src/AttributeRouting.Specs/Tests/Subdomains/RouteReflectorTests.cs (110)
M src/AttributeRouting.Specs/Tests/TrailingSlashes/AttributeRouteTests.cs (149)
M src/AttributeRouting.Specs/app.config (34)
M src/AttributeRouting.Specs/packages.config (19)
A src/AttributeRouting.Tests.SelfHost/AttributeRouting.Tests.SelfHost.csproj (113)
A src/AttributeRouting.Tests.SelfHost/Product.cs (14)
A src/AttributeRouting.Tests.SelfHost/ProductsController.cs (34)
A src/AttributeRouting.Tests.SelfHost/Program.cs (42)
A src/AttributeRouting.Tests.SelfHost/Properties/AssemblyInfo.cs (36)
A src/AttributeRouting.Tests.SelfHost/app.config (3)
A src/AttributeRouting.Tests.SelfHost/packages.config (10)
A src/AttributeRouting.Tests.Web/App_Readme/glimpse.readme.txt (0)
R src/AttributeRouting.Tests.Web/Areas/Admin/AdminAreaRegistration.cs (2)
A src/AttributeRouting.Tests.Web/Areas/Admin/Controllers/AdminControllerBase.cs (10)
R src/AttributeRouting.Tests.Web/Areas/Admin/Controllers/HomeController.cs (3)
R src/AttributeRouting.Tests.Web/Areas/Admin/Controllers/UsersController.cs (3)
A src/AttributeRouting.Tests.Web/Areas/Admin/Views/Home/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Areas/Admin/Views/Users/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Areas/Admin/Views/Web.config (0)
A src/AttributeRouting.Tests.Web/Areas/Api/ApiAreaRegistration.cs (19)
A src/AttributeRouting.Tests.Web/Areas/Api/Controllers/BaseApiController.cs (9)
A src/AttributeRouting.Tests.Web/Areas/Api/Controllers/ConventionController.cs (39)
A src/AttributeRouting.Tests.Web/Areas/Api/Controllers/LocalizationController.cs (16)
A src/AttributeRouting.Tests.Web/Areas/Api/Controllers/PlainController.cs (44)
A src/AttributeRouting.Tests.Web/AttributeRouting.Tests.Web.csproj (233)
R src/AttributeRouting.Tests.Web/Content/Styles/Site.css (4)
R src/AttributeRouting.Tests.Web/Controllers/AccountController.cs (5)
R src/AttributeRouting.Tests.Web/Controllers/BadStuffController.cs (40)
R src/AttributeRouting.Tests.Web/Controllers/ControllerBase.cs (3)
R src/AttributeRouting.Tests.Web/Controllers/DangerController.cs (42)
R src/AttributeRouting.Tests.Web/Controllers/HomeController.cs (8)
R src/AttributeRouting.Tests.Web/Controllers/LocalizationController.cs (33)
R src/AttributeRouting.Tests.Web/Controllers/NestedController.cs (3)
R src/AttributeRouting.Tests.Web/Controllers/RenderActionController.cs (9)
R src/AttributeRouting.Tests.Web/Controllers/RestfulController.cs (117)
R src/AttributeRouting.Tests.Web/Controllers/RestfulConventionController.cs (105)
R src/AttributeRouting.Tests.Web/CultureAwareRouteHandler.cs (96)
R src/AttributeRouting.Tests.Web/Global.asax (2)
A src/AttributeRouting.Tests.Web/Global.asax.cs (91)
R src/AttributeRouting.Tests.Web/Models/AccountModels.cs (2)
A src/AttributeRouting.Tests.Web/Properties/AssemblyInfo.cs (35)
R src/AttributeRouting.Tests.Web/Views/Account/ChangePassword.aspx (2)
A src/AttributeRouting.Tests.Web/Views/Account/ChangePasswordSuccess.aspx (0)
R src/AttributeRouting.Tests.Web/Views/Account/LogOn.aspx (2)
R src/AttributeRouting.Tests.Web/Views/Account/Register.aspx (2)
A src/AttributeRouting.Tests.Web/Views/AdminHome/Configuration.ascx (0)
A src/AttributeRouting.Tests.Web/Views/AdminHome/Extras.ascx (0)
A src/AttributeRouting.Tests.Web/Views/AdminHome/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/AdminHome/Quickstart.ascx (0)
A src/AttributeRouting.Tests.Web/Views/AdminHome/Setup.ascx (0)
A src/AttributeRouting.Tests.Web/Views/AdminHome/Using.ascx (0)
R src/AttributeRouting.Tests.Web/Views/BadStuff/Index.aspx (32)
R src/AttributeRouting.Tests.Web/Views/Danger/Index.aspx (34)
A src/AttributeRouting.Tests.Web/Views/Home/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Localization/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Nested/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Nested/Show.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RenderAction/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RenderAction/Partial.ascx (0)
A src/AttributeRouting.Tests.Web/Views/Restful/Delete.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Restful/Edit.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Restful/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Restful/New.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Restful/Show.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RestfulConvention/Delete.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RestfulConvention/Edit.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RestfulConvention/Index.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RestfulConvention/New.aspx (0)
A src/AttributeRouting.Tests.Web/Views/RestfulConvention/Show.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Shared/Error.aspx (0)
A src/AttributeRouting.Tests.Web/Views/Shared/LogOnUserControl.ascx (0)
A src/AttributeRouting.Tests.Web/Views/Shared/Site.Master (0)
A src/AttributeRouting.Tests.Web/Views/Web.config (0)
A src/AttributeRouting.Tests.Web/Web.Debug.config (0)
A src/AttributeRouting.Tests.Web/Web.Release.config (0)
R src/AttributeRouting.Tests.Web/Web.config (5)
A src/AttributeRouting.Tests.Web/packages.config (0)
A src/AttributeRouting.Web.Http.SelfHost/AttributeRouting.Web.Http.SelfHost.csproj (112)
A src/AttributeRouting.Web.Http.SelfHost/Framework/AttributeRoute.cs (169)
A src/AttributeRouting.Web.Http.SelfHost/Framework/AttributeRouteContainer.cs (56)
A src/AttributeRouting.Web.Http.SelfHost/Framework/Factories/AttributeRouteFactory.cs (34)
A src/AttributeRouting.Web.Http.SelfHost/Framework/Factories/HttpRouteConstraintFactory.cs (17)
A src/AttributeRouting.Web.Http.SelfHost/Framework/Factories/RouteParameterFactory.cs (14)
A src/AttributeRouting.Web.Http.SelfHost/Framework/RouteBuilder.cs (16)
A src/AttributeRouting.Web.Http.SelfHost/Framework/RouteReflector.cs (12)
A src/AttributeRouting.Web.Http.SelfHost/HttpAreaConfiguration.cs (20)
A src/AttributeRouting.Web.Http.SelfHost/HttpAttributeRoutingConfiguration.cs (11)
A src/AttributeRouting.Web.Http.SelfHost/HttpRouteCollectionExtensions.cs (63)
A src/AttributeRouting.Web.Http.SelfHost/Logging/LoggingExtensions.cs (28)
A src/AttributeRouting.Web.Http.SelfHost/Properties/AssemblyInfo.cs (6)
A src/AttributeRouting.Web.Http.SelfHost/RegexRouteConstraint.cs (23)
A src/AttributeRouting.Web.Http.SelfHost/RegexRouteConstraintAttribute.cs (47)
A src/AttributeRouting.Web.Http.SelfHost/RestfulHttpMethodConstraint.cs (26)
A src/AttributeRouting.Web.Http.SelfHost/RouteConstraintAttribute.cs (44)
A src/AttributeRouting.Web.Http.SelfHost/packages.config (8)
A src/AttributeRouting.Web.Http.WebHost/AttributeRouting.Web.Http.WebHost.csproj (108)
A src/AttributeRouting.Web.Http.WebHost/Framework/AttributeRoute.cs (21)
A src/AttributeRouting.Web.Http.WebHost/Framework/AttributeRouteContainer.cs (53)
A src/AttributeRouting.Web.Http.WebHost/Framework/Factories/HttpAttributeRouteFactory.cs (27)
A src/AttributeRouting.Web.Http.WebHost/Framework/Factories/RouteParameterFactory.cs (13)
A src/AttributeRouting.Web.Http.WebHost/Framework/HttpWebRouteBuilder.cs (20)
A src/AttributeRouting.Web.Http.WebHost/HttpAreaConfiguration.cs (16)
A src/AttributeRouting.Web.Http.WebHost/HttpAttributeRoutingConfiguration.cs (13)
A src/AttributeRouting.Web.Http.WebHost/Properties/AssemblyInfo.cs (6)
A src/AttributeRouting.Web.Http.WebHost/RouteCollectionExtensions.cs (63)
A src/AttributeRouting.Web.Http.WebHost/packages.config (9)
A src/AttributeRouting.Web.Http/AttributeRouting.Web.Http.csproj (102)
A src/AttributeRouting.Web.Http/DELETEAttribute.cs (9)
A src/AttributeRouting.Web.Http/DefaultHttpRouteConventionAttribute.cs (109)
A src/AttributeRouting.Web.Http/GETAttribute.cs (7)
A src/AttributeRouting.Web.Http/HttpConventionAttribute.cs (45)
A src/AttributeRouting.Web.Http/HttpRouteAttribute.cs (52)
A src/AttributeRouting.Web.Http/OPTIONSAttribute.cs (10)
A src/AttributeRouting.Web.Http/POSTAttribute.cs (10)
A src/AttributeRouting.Web.Http/PUTAttribute.cs (7)
A src/AttributeRouting.Web.Http/Properties/AssemblyInfo.cs (6)
A src/AttributeRouting.Web.Http/TRACEAttribute.cs (10)
A src/AttributeRouting.Web.Http/packages.config (8)
A src/AttributeRouting.Web.Mvc/AreaConfiguration.cs (14)
A src/AttributeRouting.Web.Mvc/AttributeRouting.Web.Mvc.csproj (90)
A src/AttributeRouting.Web.Mvc/AttributeRoutingConfiguration.cs (12)
R src/AttributeRouting.Web.Mvc/DELETEAttribute.cs (2)
A src/AttributeRouting.Web.Mvc/Framework/AttributeRoute.cs (20)
A src/AttributeRouting.Web.Mvc/Framework/AttributeRouteContainer.cs (52)
A src/AttributeRouting.Web.Mvc/Framework/Factories/MvcAttributeRouteFactory.cs (27)
A src/AttributeRouting.Web.Mvc/Framework/Factories/UrlParameterFactory.cs (13)
A src/AttributeRouting.Web.Mvc/Framework/RouteBuilder.cs (14)
A src/AttributeRouting.Web.Mvc/Framework/RouteReflector.cs (14)
R src/AttributeRouting.Web.Mvc/GETAttribute.cs (2)
R src/AttributeRouting.Web.Mvc/POSTAttribute.cs (2)
R src/AttributeRouting.Web.Mvc/PUTAttribute.cs (2)
A src/AttributeRouting.Web.Mvc/Properties/AssemblyInfo.cs (6)
R src/AttributeRouting.Web.Mvc/RestfulRouteConventionAttribute.cs (17)
R src/AttributeRouting.Web.Mvc/RouteAttribute.cs (179)
R src/AttributeRouting.Web.Mvc/RouteCollectionExtensions.cs (13)
R src/AttributeRouting.Web.Mvc/RouteConventionAttribute.cs (12)
D src/AttributeRouting.Web/Areas/Admin/Controllers/AdminControllerBase.cs (10)
M src/AttributeRouting.Web/AttributeRouting.Web.csproj (259)
R src/AttributeRouting.Web/Framework/AttributeRoute.cs (388)
A src/AttributeRouting.Web/Framework/Factories/AttributeRouteFactory.cs (29)
A src/AttributeRouting.Web/Framework/Factories/ConstraintFactory.cs (15)
A src/AttributeRouting.Web/Framework/RouteBuilder.cs (15)
A src/AttributeRouting.Web/Framework/RouteReflector.cs (12)
D src/AttributeRouting.Web/Global.asax.cs (60)
R src/AttributeRouting.Web/Helpers/HttpRequestBaseExtensions.cs (107)
A src/AttributeRouting.Web/Logging/LogRoutes.html (0)
R src/AttributeRouting.Web/Logging/LogRoutesHandler.cs (247)
A src/AttributeRouting.Web/Logging/LoggingExtensions.cs (28)
M src/AttributeRouting.Web/Properties/AssemblyInfo.cs (35)
A src/AttributeRouting.Web/RegexRouteConstraint.cs (23)
R src/AttributeRouting.Web/RegexRouteConstraintAttribute.cs (4)
A src/AttributeRouting.Web/RestfulHttpMethodConstraint.cs (22)
R src/AttributeRouting.Web/RouteConstraintAttribute.cs (12)
A src/AttributeRouting.Web/WebAreaConfiguration.cs (19)
A src/AttributeRouting.Web/WebAttributeRoutingConfiguration.cs (43)
M src/AttributeRouting.sln (122)
M src/AttributeRouting/AreaConfiguration.cs (70)
M src/AttributeRouting/AttributeRouting.csproj (201)
M src/AttributeRouting/AttributeRoutingConfiguration.cs (472)
A src/AttributeRouting/Constraints/IAttributeRouteConstraint.cs (22)
A src/AttributeRouting/Constraints/IRegexRouteConstraint.cs (18)
A src/AttributeRouting/Constraints/IRestfulHttpMethodConstraint.cs (15)
A src/AttributeRouting/Constraints/RegexRouteConstraintBase.cs (34)
A src/AttributeRouting/Framework/AttributeRouteContainerBase.cs (56)
A src/AttributeRouting/Framework/Factories/IAttributeRouteFactory.cs (22)
A src/AttributeRouting/Framework/Factories/IConstraintFactory.cs (10)
A src/AttributeRouting/Framework/Factories/IParameterFactory.cs (15)
A src/AttributeRouting/Framework/IAttributeRouteContainer.cs (45)
M src/AttributeRouting/Framework/Localization/ControllerTranslationBuilder.cs (125)
M src/AttributeRouting/Framework/Localization/FluentTranslationProvider.cs (114)
M src/AttributeRouting/Framework/Localization/TranslationBuilder.cs (87)
M src/AttributeRouting/Framework/Localization/TranslationKeyGenerator.cs (192)
M src/AttributeRouting/Framework/Localization/TranslationProviderBase.cs (104)
M src/AttributeRouting/Framework/RouteBuilder.cs (660)
M src/AttributeRouting/Framework/RouteReflector.cs (343)
M src/AttributeRouting/Framework/RouteSpecification.cs (99)
M src/AttributeRouting/Helpers/ExpressionHelper.cs (36)
D src/AttributeRouting/Helpers/MvcExtensions.cs (22)
M src/AttributeRouting/Helpers/ObjectExtensions.cs (52)
M src/AttributeRouting/Helpers/ReflectionExtensions.cs (92)
M src/AttributeRouting/Helpers/StringExtensions.cs (16)
A src/AttributeRouting/IRouteAttribute.cs (47)
A src/AttributeRouting/IRouteConvention.cs (40)
A src/AttributeRouting/Logging/AttributeRouteInfo.cs (68)
A src/AttributeRouting/Logging/LogWriter.cs (67)
D src/AttributeRouting/Logging/LoggingExtensions.cs (73)
M src/AttributeRouting/Properties/AssemblyInfo.cs (45)
D src/AttributeRouting/RegexRouteConstraint.cs (51)
D src/AttributeRouting/RestfulHttpMethodConstraint.cs (31)
A src/SharedAssemblyInfo.cs (12)
D src/packages/Glimpse.0.84/Glimpse.0.84.nupkg (0)
D src/packages/Glimpse.0.84/content/App_Readme/glimpse.readme.txt (217)
D src/packages/Glimpse.0.84/content/web.config.transform (24)
D src/packages/Glimpse.0.84/lib/net40/Glimpse.Core.dll (0)
D src/packages/Glimpse.0.84/tools/install.ps1 (5)
D src/packages/Moq.3.1.416.3/Moq.3.1.416.3.nupkg (0)
D src/packages/Moq.3.1.416.3/lib/Moq.dll (0)
D src/packages/MvcContrib.Mvc3.TestHelper-ci.3.0.91.0/MvcContrib.Mvc3.TestHelper-ci.3.0.91.0.nupkg (0)
D src/packages/MvcContrib.Mvc3.TestHelper-ci.3.0.91.0/lib/MvcContrib.TestHelper.dll (0)
D src/packages/NUnit.2.5.7.10213/Logo.ico (0)
D src/packages/NUnit.2.5.7.10213/NUnit.2.5.7.10213.nupkg (0)
D src/packages/NUnit.2.5.7.10213/NUnitFitTests.html (277)
D src/packages/NUnit.2.5.7.10213/Tools/NUnitFitTests.html (277)
D src/packages/NUnit.2.5.7.10213/Tools/NUnitTests.config (84)
D src/packages/NUnit.2.5.7.10213/Tools/NUnitTests.nunit (14)
D src/packages/NUnit.2.5.7.10213/Tools/agent.conf (4)
D src/packages/NUnit.2.5.7.10213/Tools/agent.log.conf (18)
D src/packages/NUnit.2.5.7.10213/Tools/launcher.log.conf (18)
D src/packages/NUnit.2.5.7.10213/Tools/lib/Failure.png (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/Ignored.png (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/Inconclusive.png (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/Skipped.png (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/Success.png (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/fit.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/log4net.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit-console-runner.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit-gui-runner.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit.core.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit.core.interfaces.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit.fixtures.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit.uiexception.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit.uikit.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/lib/nunit.util.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-agent-x86.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-agent-x86.exe.config (76)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-agent.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-agent.exe.config (76)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-console-x86.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-console-x86.exe.config (76)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-console.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-console.exe.config (76)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-x86.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit-x86.exe.config (91)
D src/packages/NUnit.2.5.7.10213/Tools/nunit.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/nunit.exe.config (91)
D src/packages/NUnit.2.5.7.10213/Tools/nunit.framework.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/pnunit-agent.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/pnunit-agent.exe.config (77)
D src/packages/NUnit.2.5.7.10213/Tools/pnunit-launcher.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/pnunit-launcher.exe.config (77)
D src/packages/NUnit.2.5.7.10213/Tools/pnunit.framework.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/pnunit.tests.dll (0)
D src/packages/NUnit.2.5.7.10213/Tools/runFile.exe (0)
D src/packages/NUnit.2.5.7.10213/Tools/runFile.exe.config (43)
D src/packages/NUnit.2.5.7.10213/Tools/runpnunit.bat (2)
D src/packages/NUnit.2.5.7.10213/Tools/test.conf (24)
D src/packages/NUnit.2.5.7.10213/fit-license.txt (342)
D src/packages/NUnit.2.5.7.10213/lib/nunit.framework.dll (0)
D src/packages/NUnit.2.5.7.10213/lib/nunit.framework.xml (10228)
D src/packages/NUnit.2.5.7.10213/lib/nunit.mocks.dll (0)
D src/packages/NUnit.2.5.7.10213/lib/pnunit.framework.dll (0)
D src/packages/NUnit.2.5.7.10213/license.txt (15)
D src/packages/RhinoMocks.3.6/RhinoMocks.3.6.nupkg (0)
D src/packages/RhinoMocks.3.6/lib/Rhino.Mocks.dll (0)
D src/packages/SpecFlow.1.4.0/LICENSE.txt (28)
D src/packages/SpecFlow.1.4.0/SpecFlow.1.4.0.nupkg (0)
D src/packages/SpecFlow.1.4.0/Tools/Gherkin.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/IKVM.OpenJDK.Core.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/IKVM.OpenJDK.Security.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/IKVM.OpenJDK.Text.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/IKVM.Runtime.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.Generator.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.Parser.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.Reporting.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.Silverlight.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.Utils.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.dll (0)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.targets (58)
D src/packages/SpecFlow.1.4.0/Tools/TechTalk.SpecFlow.tasks (17)
D src/packages/SpecFlow.1.4.0/Tools/specflow.exe (0)
D src/packages/SpecFlow.1.4.0/content/app.config.transform (27)
D src/packages/SpecFlow.1.4.0/lib/TechTalk.SpecFlow.dll (0)
D src/packages/repositories.config (5)

-- Patch Links --

https://github.com/mccalltd/AttributeRouting/pull/57.patch
https://github.com/mccalltd/AttributeRouting/pull/57.diff


Reply to this email directly or view it on GitHub:
#57

@mccalltd
Copy link
Owner

mccalltd commented Apr 9, 2012

You're hired! I'll look it over tomorrow or Tues and merge. I'm starting to build an app with MVC 4 and having Web API support will be nice! Seriously much appreciated contribution as I've been slammed with other things recently. Also realized I was on your blog earlier this week checking out some of your writeup on cassette :).

t

On Apr 8, 2012, at 9:05 PM, Kamran Ayub wrote:

Alright, sir! It's ready for being pulled in.

Changes

  • No generics now! Yay!
  • Much simpler than I first came up with
  • It shouldn't be hard to get acquainted with the new changes
  • Nuget packaging and building for release is much simpler now. Just use build.cmd in the root, and once you want to push your packages, build.cmd NugetPush. This is the way Andrew did it in Cassette and I think it's a slick approach.

Reply to this email directly or view it on GitHub:
#57 (comment)

@PureKrome
Copy link

👏

@mccalltd
Copy link
Owner

Was just looking things over. Ran build and got an error "'nuget' is not recognized as an internal or external command, operable program or batch file." So would be good to fix that. Otherwise, I'm ready to merge and push out v2. Just want to make sure that you can update the wiki where appropriate?

@kamranayub
Copy link
Contributor Author

Whoops, I have nuget installed in my PATH but not everyone does. I will have it point to the exe included in src\.nuget.

And yes, I'll update the wiki.

@mccalltd
Copy link
Owner

Kamran -- I just merged a bug fix that you'll want to merge into your feature branch.

@kamranayub
Copy link
Contributor Author

Alright, should be good to go!

@mccalltd
Copy link
Owner

Hey - so by good to go, you mean you're ready to have this merged in to master? I know you had said you wanted a couple more days mid-week to tidy some things.

@kamranayub
Copy link
Contributor Author

Yup!

On Sun, Apr 15, 2012 at 11:52 AM, Tim McCall <
reply@reply.github.com

wrote:

Hey - so by good to go, you mean you're ready to have this merged in to
master? I know you had said you wanted a couple more days mid-week to tidy
some things.


Reply to this email directly or view it on GitHub:
#57 (comment)

Kamran Ayub

@mccalltd
Copy link
Owner

Just looking stuff over before merging. Noticed that the tests are failing. Also wondering why you have both interfaces and abstract base classes in AttributeRouting? For example: RouteConstraintAttributeBase, and IAttributeRouteConstraint. I would prefer fewer files if the Interface does not have more than one direct implementation. I'm going through stuff getting the tests running again and being a code and formatting Nazi. Might have to ping ya with a few more questions, which I'll add to this comment as they arise. Cheers!

mccalltd added a commit that referenced this pull request Apr 16, 2012
…(had single impl in abstract base classes - those are good enough for me). fixed broken tests.
@mccalltd
Copy link
Owner

I merged your branch, but into a new branch: 57-web-api. I'm still poking around. You should base any futher work off of this branch (until it goes into master, of course).

@mccalltd mccalltd closed this Apr 16, 2012
@mccalltd mccalltd reopened this Apr 16, 2012
mccalltd added a commit that referenced this pull request Apr 16, 2012
…ull plug-and-chug (ie: no missing imports, etc).
@mccalltd
Copy link
Owner

IT'S ALIVE! v2 is live on nuget. Thanks for your hard work. Thanks for the new build tool, too. That was a backburner todo for a long time.

@mccalltd mccalltd closed this Apr 16, 2012
@mccalltd
Copy link
Owner

@kamranayub
Copy link
Contributor Author

Are the tests still failing? I will take a look if so. I'll get back to you on the interfaces; most of them are for generating framework-agnostic types... for example, constraints in MVC use IRouteConstraint but in Web API it's IHttpRouteConstraint. In order to handle both of those types in the AR Core, we need a generalized interface that either a) uses generics or b) uses object, I went first with a) but found generics to then be exposed all the way up to the config level... so I went with b) instead because while it was less strongly-typed, I took care of that in derived classes. The base classes are there for sharing common logic across both frameworks, rather than maintaining separate base classes in the two modes.

@mccalltd
Copy link
Owner

I fixed the tests, massaged some inconsistent formatting, and released
v2 on nuget. Feel free to work from master now if something comes up.

On Apr 16, 2012, at 6:59 AM, Kamran Ayub
reply@reply.github.com
wrote:

Are the tests still failing? I will take a look if so. I'll get back to you on the interfaces; most of them are for generating framework-agnostic types... for example, constraints in MVC use IRouteConstraint but in Web API it's IHttpRouteConstraint. In order to handle both of those types in the AR Core, we need a generalized interface that either a) uses generics or b) uses object, I went first with a) but found generics to then be exposed all the way up to the config level... so I went with b) instead because while it was less strongly-typed, I took care of that in derived classes. The base classes are there for sharing common logic across both frameworks, rather than maintaining separate base classes in the two modes.


Reply to this email directly or view it on GitHub:
#57 (comment)

@kamranayub
Copy link
Contributor Author

Sweeeet, thanks! There is a minor issue with the default http convention,
in that it doesn't throw an exception when it matches more than one action
method (like the default logic does from Microsoft). Not a big issue but I
still got caught on it.

I've been using my v2 fork for the past week or so and it's been awesome,
I'll update to the latest official version now!

On Mon, Apr 16, 2012 at 9:20 AM, Tim McCall <
reply@reply.github.com

wrote:

I fixed the tests, massaged some inconsistent formatting, and released
v2 on nuget. Feel free to work from master now if something comes up.

On Apr 16, 2012, at 6:59 AM, Kamran Ayub
reply@reply.github.com
wrote:

Are the tests still failing? I will take a look if so. I'll get back to
you on the interfaces; most of them are for generating framework-agnostic
types... for example, constraints in MVC use IRouteConstraint but in Web
API it's IHttpRouteConstraint. In order to handle both of those types in
the AR Core, we need a generalized interface that either a) uses generics
or b) uses object, I went first with a) but found generics to then be
exposed all the way up to the config level... so I went with b) instead
because while it was less strongly-typed, I took care of that in derived
classes. The base classes are there for sharing common logic across both
frameworks, rather than maintaining separate base classes in the two modes.


Reply to this email directly or view it on GitHub:

#57 (comment)


Reply to this email directly or view it on GitHub:
#57 (comment)

Kamran Ayub

@mccalltd
Copy link
Owner

Hey Kamran -- jst getting word that v2 introduced a big (at least so I think) bug. The bottom line is routes on two actions with the same name cannot be dismbiguated since the route attributes do not derive from AttributeMethodSelectorAttribute anymore (which is in System.Web.Mvc, and not in System.Web.Http). I've spent a bit of time trying to find a way around this, and long story short -- it doesn't look good. Disambiguation in System.Web.Http is controlled by IActionMethodSelector and this is an internal interface, and the Http{verb} attributes in System.Web.Http are all sealed, so we cannot simply derive from those.

I need to step away from the problem for a bit, but just wanted to let you know I have pulled all v2 stuff from nuget, leaving the v1.7 of AR listed instead. I put a note in issue #63 with a workaround, but I am not happy with the workaround as an actual fix. Frankly I'm not sure that we can support Web API stuff without relying on multiple attributes, which makes using AR on Web API routes kind of kludgy. I would love to find a solution, but ultimately, I think Web API stuff might need to stay outside the scope of AR.

Please comment on this issue or email me and we can discuss in painful detail offline.

Cheers!

@mccalltd
Copy link
Owner

Fixed it. Was idiotic. But there's a breaking change alert: #63.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants