Class AreaRegistrationContext
Encapsulates the information that is required in order to register an area within an ASP.NET MVC application.
public class AreaRegistrationContext
- Inheritance
-
AreaRegistrationContext
- Inherited Members
Constructors
AreaRegistrationContext(string, RouteCollection)
Initializes a new instance of the AreaRegistrationContext class using the specified area name and routes collection.
public AreaRegistrationContext(string areaName, RouteCollection routes)
Parameters
areaNamestringThe name of the area to register.
routesRouteCollectionThe collection of routes for the application.
AreaRegistrationContext(string, RouteCollection, object)
Initializes a new instance of the AreaRegistrationContext class using the specified area name, routes collection, and user-defined data.
public AreaRegistrationContext(string areaName, RouteCollection routes, object state)
Parameters
areaNamestringThe name of the area to register.
routesRouteCollectionThe collection of routes for the application.
stateobjectAn object that contains user-defined information to pass to the area.
Properties
AreaName
Gets the name of the area to register.
public string AreaName { get; }
Property Value
- string
The name of the area to register.
Namespaces
Gets the namespaces for the application.
public ICollection<string> Namespaces { get; }
Property Value
- ICollection<string>
An enumerable set of namespaces for the application.
Routes
Gets a collection of defined routes for the application.
public RouteCollection Routes { get; }
Property Value
- RouteCollection
A collection of defined routes for the application.
State
Gets an object that contains user-defined information to pass to the area.
public object State { get; }
Property Value
- object
An object that contains user-defined information to pass to the area.
Methods
MapRoute(string, string)
Maps the specified URL route and associates it with the area that is specified by the AreaName property.
public Route MapRoute(string name, string url)
Parameters
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
urlparameter is null.
MapRoute(string, string, object)
Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values.
public Route MapRoute(string name, string url, object defaults)
Parameters
namestringThe name of the route.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
urlparameter is null.
MapRoute(string, string, object, object)
Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values and constraint.
public Route MapRoute(string name, string url, object defaults, object constraints)
Parameters
namestringThe name of the route.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
constraintsobjectA set of expressions that specify valid values for a URL parameter.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
urlparameter is null.
MapRoute(string, string, object, object, string[])
Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values, constraints, and namespaces.
public Route MapRoute(string name, string url, object defaults, object constraints, string[] namespaces)
Parameters
namestringThe name of the route.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
constraintsobjectA set of expressions that specify valid values for a URL parameter.
namespacesstring[]An enumerable set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
urlparameter is null.
MapRoute(string, string, object, string[])
Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values and namespaces.
public Route MapRoute(string name, string url, object defaults, string[] namespaces)
Parameters
namestringThe name of the route.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
namespacesstring[]An enumerable set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
urlparameter is null.
MapRoute(string, string, string[])
Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified namespaces.
public Route MapRoute(string name, string url, string[] namespaces)
Parameters
namestringThe name of the route.
urlstringThe URL pattern for the route.
namespacesstring[]An enumerable set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
urlparameter is null.