Skip to content

Support AttributeRouting #2

@jamesholcomb

Description

@jamesholcomb

Trying to get your included sample to work with AR by adding these to the BlogPostsController

[RoutePrefix("api/BlogPosts")]
[DefaultHttpRouteConvention]

and using the following AR routing setup

public static void RegisterRoutes(HttpRouteCollection routes) {           
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd

        routes.MapHttpAttributeRoutes(config =>
            {
                config.AutoGenerateRouteNames = true;
                config.UseLowercaseRoutes = true;
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.RouteNameBuilder = RouteNameBuilders.Unique;
            }
        );
    }

But only the GET endpoint shows up in the Swagger UI. If you check /routes.axd, you can see the list of route names and urls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions