Ram.AdminFramework
1.0.0
ASP.NET MVCの管理フレームワーク
このライブラリの基本的なアイデアは、## adminのような領域なしで管理管理ダッシュボードをクレートすることです
例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... " ) ;
}
}およびArearegistrationクラス
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、 /連絡先にマッピングされます