2011-09-13 37 views
1

什麼的RouteData數據類型和RouteTable:數據類型的RouteData在ASP.net MVC

公共靜態的RouteData GetRouteDataByUrl(字符串URL){ 回報 RouteTable.Routes.GetRouteData(新RewritedHttpContextBase(URL)); }

+0

你能否詳細說明你的問題?目前還不清楚你在問什麼。 –

回答

0

這裏有兩個類的公共方法和屬性的元數據。首先是類的RouteData:

public class RouteData 
{ 
    // Summary: 
    //  Initializes a new instance of the System.Web.Routing.RouteData class. 
    public RouteData(); 

    // 
    // Summary: 
    //  Initializes a new instance of the System.Web.Routing.RouteData class by using 
    //  the specified route and route handler. 
    // 
    // Parameters: 
    // route: 
    //  An object that defines the route. 
    // 
    // routeHandler: 
    //  An object that processes the request. 
    public RouteData(RouteBase route, IRouteHandler routeHandler); 

    // Summary: 
    //  Gets a collection of custom values that are passed to the route handler but 
    //  are not used when ASP.NET routing determines whether the route matches a 
    //  request. 
    // 
    // Returns: 
    //  An object that contains custom values. 
    public RouteValueDictionary DataTokens { get; } 

    // 
    // Summary: 
    //  Gets or sets the object that represents a route. 
    // 
    // Returns: 
    //  An object that represents the route definition. 
    public RouteBase Route { get; set; } 

    // 
    // Summary: 
    //  Gets or sets the object that processes a requested route. 
    // 
    // Returns: 
    //  An object that processes the route request. 
    public IRouteHandler RouteHandler { get; set; } 

    // 
    // Summary: 
    //  Gets a collection of URL parameter values and default values for the route. 
    // 
    // Returns: 
    //  An object that contains values that are parsed from the URL and from default 
    //  values. 
    public RouteValueDictionary Values { get; } 

    // Summary: 
    //  Retrieves the value with the specified identifier. 
    // 
    // Parameters: 
    // valueName: 
    //  The key of the value to retrieve. 
    // 
    // Returns: 
    //  The element in the System.Web.Routing.RouteData.Values property whose key 
    //  matches valueName. 
    // 
    // Exceptions: 
    // System.InvalidOperationException: 
    //  A value does not exist for valueName. 
    public string GetRequiredString(string valueName); 
} 

二是RoutTable類:

// Summary: 
//  Stores the URL routes for an application. 
[TypeForwardedFrom("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")] 
public class RouteTable 
{ 
    // Summary: 
    //  Initializes a new instance of the System.Web.Routing.RouteTable class. 
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] 
    public RouteTable(); 

    // Summary: 
    //  Gets a collection of objects that derive from the System.Web.Routing.RouteBase 
    //  class. 
    // 
    // Returns: 
    //  An object that contains all the routes in the collection. 
    public static RouteCollection Routes { get; } 
} 

你有這些類更具體的問題嗎?