Share via


VersionedApiResourceRegistration.RegisterResource Method

Register an API resource location/route. The controller should be named {area}{resource}Controller or it can use a [VersionedApiControllerCustomName] attribute to use a non-conventional name.

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

Syntax

'Declaration
Public Shared Function RegisterResource ( _
    routes As HttpRouteCollection, _
    locationId As Guid, _
    area As String, _
    resource As String, _
    routeTemplate As String, _
    defaults As Object, _
    constraints As Object, _
    handler As HttpMessageHandler, _
    routeName As String, _
    resourceVersion As Integer, _
    defaultApiVersion As Version, _
    minApiVersion As Version, _
    maxApiVersion As Version, _
    releasedApiVersion As Version _
) As IHttpRoute
public static IHttpRoute RegisterResource(
    HttpRouteCollection routes,
    Guid locationId,
    string area,
    string resource,
    string routeTemplate,
    Object defaults,
    Object constraints,
    HttpMessageHandler handler,
    string routeName,
    int resourceVersion,
    Version defaultApiVersion,
    Version minApiVersion,
    Version maxApiVersion,
    Version releasedApiVersion
)
public:
static IHttpRoute^ RegisterResource(
    HttpRouteCollection^ routes, 
    Guid locationId, 
    String^ area, 
    String^ resource, 
    String^ routeTemplate, 
    Object^ defaults, 
    Object^ constraints, 
    HttpMessageHandler^ handler, 
    String^ routeName, 
    int resourceVersion, 
    Version^ defaultApiVersion, 
    Version^ minApiVersion, 
    Version^ maxApiVersion, 
    Version^ releasedApiVersion
)
static member RegisterResource : 
        routes:HttpRouteCollection * 
        locationId:Guid * 
        area:string * 
        resource:string * 
        routeTemplate:string * 
        defaults:Object * 
        constraints:Object * 
        handler:HttpMessageHandler * 
        routeName:string * 
        resourceVersion:int * 
        defaultApiVersion:Version * 
        minApiVersion:Version * 
        maxApiVersion:Version * 
        releasedApiVersion:Version -> IHttpRoute
public static function RegisterResource(
    routes : HttpRouteCollection, 
    locationId : Guid, 
    area : String, 
    resource : String, 
    routeTemplate : String, 
    defaults : Object, 
    constraints : Object, 
    handler : HttpMessageHandler, 
    routeName : String, 
    resourceVersion : int, 
    defaultApiVersion : Version, 
    minApiVersion : Version, 
    maxApiVersion : Version, 
    releasedApiVersion : Version
) : IHttpRoute

Parameters

  • locationId
    Type: System.Guid

    Unique id of the location/route

  • routeTemplate
    Type: System.String

    (Parameterized) Route template

  • defaults
    Type: System.Object

    Optional defaults object/RouteValueDictionary

  • constraints
    Type: System.Object

    Optional constraints object/RouteValueDictionary

  • routeName
    Type: System.String

    Optional name of the route (can be used to differentiate multiple routes for the same resource)

  • resourceVersion
    Type: System.Int32

    The current/latest resource version for this resource

  • defaultApiVersion
    Type: System.Version

    The default API version to use if no api version is specified in the request

  • minApiVersion
    Type: System.Version

    The minimum API version supported by this resource

  • maxApiVersion
    Type: System.Version

    The maximum API version supported by this resource

  • releasedApiVersion
    Type: System.Version

    The latest released (non-preview) API version for this resource

Return Value

Type: System.Web.Http.Routing.IHttpRoute
The registered IHttpRoute

.NET Framework Security

See Also

Reference

VersionedApiResourceRegistration Class

Microsoft.TeamFoundation.Framework.Server Namespace