AreaRegistration 类

提供在 ASP.NET MVC 应用程序内注册一个或多个区域的方式。

继承层次结构:
SystemObject
System.Web.MvcAreaRegistration

 

命名空间:   System.Web.Mvc
程序集:  System.Web.Mvc(在 System.Web.Mvc.dll 中)
 
语法
 
AreaRegistration
AreaRegistration
class AreaRegistration
abstract
[<AbstractClassAttribute>]
type AreaRegistration =  class end
class AreaRegistration

AreaRegistration 类型公开以下成员。

构造函数
  名称 说明
[收藏]AreaRegistration 类 AreaRegistration 初始化 AreaRegistration 类的新实例。
属性
  名称 说明
[收藏]AreaRegistration 类 AreaName 获取要注册的区域的名称。
方法
  名称 说明
[收藏]AreaRegistration 类 Equals (从 Object 继承。)
[收藏]AreaRegistration 类 Finalize (从 Object 继承。)
[收藏]AreaRegistration 类 GetHashCode (从 Object 继承。)
[收藏]AreaRegistration 类 GetType (从 Object 继承。)
[收藏]AreaRegistration 类 MemberwiseClone (从 Object 继承。)
[收藏]AreaRegistration 类 [收藏]AreaRegistration 类 RegisterAllAreas 注册 ASP.NET MVC 应用程序中的所有区域。
[收藏]AreaRegistration 类 [收藏]AreaRegistration 类 RegisterAllAreas(Object) 使用指定的用户定义信息在 ASP.NET MVC 应用程序内注册所有区域。
[收藏]AreaRegistration 类 RegisterArea 使用指定区域的上下文信息在 ASP.NET MVC 应用程序内注册某个区域。
[收藏]AreaRegistration 类 ToString (从 Object 继承。)
注释

RegisterArea方法,该方法将为新区域注册路由信息。

AreaRegistration类。

 } 
        ); 
    } 
}
Public Class BlogAreaRegistration
    Inherits AreaRegistration

    Public Overrides ReadOnly Property AreaName() As String
        Get
            Return "Blog"
        End Get
    End Property

    Public Overrides Sub RegisterArea(ByVal context As System.Web.Mvc.AreaRegistrationContext)
        context.MapRoute( _
            "Blog_default", _
           "Blog/{controller}/{action}/{id}", _
            New With {.action = "Index", .id = ""} _
        )
    End Sub
End Class

RegisterAllAreas 方法的调用。

RegisterRoutes方法。

// Parameter defaults 
    ); 
}
[Visual Basic]
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
    AreaRegistration.RegisterAllAreas()
    routes.MapRoute( _
        "Default", _
        "{controller}/{action}/{id}", _
        New With {.controller = "Home", .action = "Index", .id = ""} _
    )

End Sub
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。不保证所有实例成员都是线程安全的。
 
请参阅

相关文章:

  • 2021-06-29
  • 2022-12-23
  • 2021-06-26
  • 2021-07-23
猜你喜欢
  • 2021-10-04
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-07-07
  • 2022-03-04
相关资源
相似解决方案