Ram.AdminFramework
1.0.0
ASP.NET MVC의 관리 프레임 워크
이 라이브러리의 기본 아이디어는 ## 관리자와 같은 영역이없는 관리 대시 보드입니다.
예 1 : 지역 주택의 기본 홈 컨트롤러
public class HomeController : Controller {
public ActionResult Index ( ) {
return Content ( "this is home page... " ) ;
}
public ActionResult About ( ) {
return Content ( "this is about page... " ) ;
}
public ActionResult Contacts ( ) {
return Content ( "this is contacts page... " ) ;
}
}그리고 비로화 수업
public class HomeAreaRegistration : AreaRegistration {
public override void RegisterArea ( AreaRegistrationContext context ) {
context . Routes . MapRoute ( "index" , "" , new {
controller = "Home" ,
action = "index"
} ) ;
context . Routes . MapRoute ( "about" , "about" , new {
controller = "Home" ,
action = "about"
} ) ;
context . Routes . MapRoute ( "contacts" , "contacts" , new {
controller = "Home" ,
action = "contacts"
} ) ;
}
public override string AreaName { get ; } = "Home" ;
}이제 AreareGistrationContext 클래스가 필요하지 않고이 작업을 수행 할 수 있습니다.
RouteManager . GetProvider ( )
. WithArea ( "Home" )
. WithController ( "Home" )
. withAction ( "" , "index" , "index" )
. withAction ( "about" , "about" )
. withAction ( "contacts" , "contacts" ) ;또는 컨트롤러 동작과 동일한 이름의 경로를 사용하려면 사용할 수 있습니다.
RouteManager . GetProvider ( )
. WithArea ( "Home" )
. WithController ( "Home" )
. withActions ( "index" , "about" , "contacts" ) ;/index, /about, /contact에 매핑됩니다