ASP.NET MVC ? ?????????! - PowerPoint PPT Presentation

About This Presentation
Title:

ASP.NET MVC ? ?????????!

Description:

asp.net mvc lt ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 23
Provided by: wankumaCo
Category:
Tags: asp | mvc | net

less

Transcript and Presenter's Notes

Title: ASP.NET MVC ? ?????????!


1
ASP.NET MVC ??????????!
  • ????

2
??!
  • ???LT?????????????????????
  • ??????????????
  • ????????????????
  • ??????????????????????????????????

3
ASP.NET MVC ??
  • ASP.NET 4.0 ?????????????
  • AJAX ??????????????????
  • Web Form ?????HTML ( CSS ? JS) ????????
  • ????????????
  • ?? Web ??????????
  • ??????????????????
  • ??????
  • TDD?????????????

4
MVC ??????
  • Model View Controller ??
  • ??? DB ???????????????
  • ??? ??????????
  • ?????? ????????????????????
  • ASP.NET MVC ??????? V ? C
  • Model ? LINQ to SQL ??

5
ASP.NET MVC ?????
  • ??????
  • ??????????????????????
  • ??????
  • ???????????
  • ???????????????????????
  • ???
  • ????????? HTML
  • ASP.NET MVC ?? aspx ? ascx ?????

6
ASP.NET MVC ??????
  • ?????????? ? URI ???????????????????
  • ??????? /controller/action/id
  • ??????????????????????????????????????
  • ?????????????????????????? URI ??????????????
  • ??????? DB ???????????????????????????????????
  • ??? (aspx ? ascx) ??????????
  • ??????????

7
??????
  • ?????? /controller/action/id
  • /users/details/shiba-yan ?
  • controller users
  • action details
  • id shiba-yan ???
  • ?????? UsersController.Details(string id)?????
  • ?????????????????
  • ?????????? / ??? HomeController.Index ?????
  • ?id ??????????????????????
  • ???? case-insensitive ??

8
???????????
  • MapRoute ?????
  • MVC FW ????????????
  • ????????????????????
  • ??? MapRoute(??,URL????)
  • ???????????????????????????

9
??????(??????)
  • ???????
  • Controllers ???????? ??????? Controller ??????
  • ??? Users Controller UsersController
  • ????????????????????????? public ?
  • ????????????????????
  • VS ?????????????

10
ActionResult
  • ?????? ActionResult ??????????????????????
  • return View() ? ViewResult ???????????
  • ????????????????????????????????
  • View ???????? File/Redirect/Json/JavaScript/Conten
    t ??????????????
  • ????????????????

11
ASP.NET MVC ???
  • ???????????????????????????
  • lt OutputCache gt ????????
  • ????????????
  • ????????????????
  • ??????? ActionFilterAttribute ???
  • ???????????
  • ???????????????

12
??(1)
  • AcceptVerbs
  • ????? HTTP ?????????
  • ActionName
  • ???????????
  • Authorize
  • ????????
  • HandleError
  • ???????????
  • ????????????????????

13
??(2)
  • OutputCache
  • ????????????
  • ValidateAntiForgeryToken
  • CSRF ?????????????????
  • Html.AntiForgeryToken ????????????
  • ValidateInput
  • ???????????????????
  • ????????

14
???
  • LINQ to SQL ? Entity Framework ???????
  • ???? Entity Framework ???????????
  • ?????????????????
  • MS ??????????????????
  • ??????????? Repository ?
  • ??????? DataContext ? Entities ????????

15
???????
  • controller ? action ??????????????????????????????
    ?
  • NullableltTgt ?????????????
  • ????????????????
  • ????????????????????????????
  • ?????????????????????????????
  • (Try)UpdateModel ????????????
  • ????????????? Update ??

16
???
  • ?????????
  • Views/(???????Shared)/??????.aspx ??
  • Shared ???????????????????????
  • ????????? ????????? -gt Shared ??
  • lt gt ????????????????
  • HtmlHelperltTModelgt ???????????????????????
  • AjaxHelper ???????????(ry
  • VS ?????????????
  • CtrlM,V ?????
  • scaffolding ????????
  • (????????????)???

17
??????????
  • ??????????? 2 ??????
  • ViewData ?????????????
  • View ????????????
  • ???????????
  • ViewData ?????????????
  • Model ????????????
  • ViewData ? object ??????Model ????????

18
??????
  • ???????????
  • Model ?? IEnumerableltTgt ??????????????????????????
    ?????
  • ??????? Model ? IEnumerableltTgt ??ViewData
    ?????????????
  • ?? ViewData ?? object ????????????????????
  • ????IEnumerableltTgt ???????????????????!
  • ???????????????????????
  • MVC ??????????

19
???????
  • ViewPage ?? 3 ??????????????????????????????
  • Ajax/Html/Url ? 3 ?????
  • ??? AjaxHelper/HtmlHelper/UrlHelper
  • ?????? HtmlHelper
  • ???????????????????????????????
  • lt Html.ActionLink("???", "index", "home") gt
    ??????????

20
Ajax
  • MicrosoftAjax ?????????????????????????
  • AjaxHelper ? ViewPage.Ajax ???????????
  • Ajax.ActionLink/RouteLink/BeginForm/BeginRouteForm
    ??????????????
  • Ajax ??????????? XHR ? HTML ?????????????
  • HTML ?????????????????PartialView ???????

21
???????
  • Html.ActionLink ? Url.Action ???
  • ???????????????????????????????
  • Html.RouteLink ? Url.RouteUrl ???
  • ??????????????????????
  • ????????????
  • lt OutputCache gt ??????
  • OutputCache ???????

22
???????
  • HTML CSS ?????????????
  • Web Form ????? HTML ????????
  • ????????????????????
  • ???????? HTML ?????????????????????????
  • ??????????????????????
  • ??????????????????????
  • ???????????????????
  • ????? URI ??????(?
  • /User.aspx?idshiba-yan -gt /shiba-yan/
Write a Comment
User Comments (0)
About PowerShow.com