Qhov txawv ntawm webforms thiab MVC yog dab tsi?
Qhov txawv ntawm webforms thiab MVC yog dab tsi?

Video: Qhov txawv ntawm webforms thiab MVC yog dab tsi?

Video: Qhov txawv ntawm webforms thiab MVC yog dab tsi?
Video: Электронная почта с Python 2024, Kaum ib hlis
Anonim

ASP. NET Web Forms siv Page controller pattern approach rau rendering layout. Hauv txoj hauv kev no, txhua nplooj ntawv muaj nws tus kheej tswj hwm, piv txwv li, code-qab cov ntaub ntawv uas ua cov ntawv thov. ASP. NET MVC siv Front Controller mus kom ze. Txoj hauv kev ntawd txhais tau hais tias tus tswj hwm rau txhua nplooj ntawv ua cov lus thov.

Tsis tas li ntawd, qhov twg zoo dua MVC lossis Webforms?

Qhov zoo ntawm MVC Tshaj Webforms Lub teeb nyhav: MVC nplooj ntawv yog sib dua li piv rau webforms raws li lawv tsis nqa bulky viewsstate nrog lawv. Zoo dua Tswj kev tsim: MVC tau tso tseg lub tswv yim ntawm kev tswj hwm server thiab siv cov kev tswj hwm HTML lossis HTML pab tsim kom muaj kev tswj hwm HTML.

Kuj Paub, vim li cas peb thiaj siv MVC siv cov ntawv web? Qhov zoo ntawm ASP. NET MVC yog:

  • Ua kom muaj kev tswj hwm tag nrho ntawm qhov ua tiav HTML.
  • Muab kev sib cais huv ntawm kev txhawj xeeb (SoC).
  • Enables Test Driven Development (TDD).
  • Ib qho yooj yim kev koom ua ke nrog JavaScript moj khaum.
  • Ua raws li kev tsim ntawm lub xeev tsis muaj xwm txheej ntawm lub vev xaib.
  • RESTful urls uas ua rau SEO.

Hauv qhov no, peb puas tuaj yeem siv webforms hauv MVC?

Cov lus nug ntawm yuav ua li cas muab ob qho tib si thev naus laus zis hauv ib daim ntawv thov tshwm sim-nws puas tuaj yeem ua ke ob qho tib si ASP. NET Webforms thiab ASP. NET MVC hauv ib daim ntawv thov web? Hmoov zoo, cov lus teb yog yog. Combining ASP. NET Webforms thiab ASP. NET MVC hauv ib daim ntawv thov yog ua tau-qhov tseeb, nws yooj yim heev.

Qhov txawv ntawm MVC 5 thiab MVC core yog dab tsi?

Qhov txawv 1 - Ib leeg ua ke lub vev xaib pawg rau ASP. NET Core MVC thiab Web APIs. ASP. NET MVC 5 yuav muab peb txoj kev xaiv MVC los yog Web API los yog ob qho tib si thaum tsim ib daim ntawv thov web. Nws yog vim lub web pawg rau MVC 5 thiab Web API tsis zoo ib yam. ASP. NET Core MVC tam sim no muaj ib lub vev xaib sib koom ua ke rau MVC thiab Web API.

Pom zoo: