MVC Rounting System 學習心得

2021-09-02 04:05:59 字數 895 閱讀 2791

1.所有的routing 規則都存在routtable.routes這個全域性的collection當中

routeconfig.registerroutes(routetable.routes);

2.下面是具體的方法,將所有的routing規則註冊到全域性變數裡。

public

static

void

registerroutes(routecollection routes) /

", new

mvcroutehandler());

routes.add(

"myroute

", myroute);

}

3.當使用者在輸入url之後,到到達伺服器端時,mvc 框架將會在所有全域性變數裡的routes去解析url,最後得到乙個routedata,這個routedata將包含values的乙個鍵值對列表,其中有兩個最為重要的鍵值對:values["controller"],values["action"],得到這兩個東東之後,再由mvcroutehandler例項化new mvchandler(requestcontext);到controller的factory,去例項化對應的controller,然後再去invoke相應的action,而且得到的routedata在action裡都是可以訪問的。

這裡補充說明一點,routes.getrotedata呼叫的時候,其實是首先嘗試輪訓所有的route,然後呼叫route.getroutedata方法,如果找到了可以handle當前url的route,就呼叫那個route的getroutedata方法得到routedata

SET IDENTITY INSERT 學習心得

color indigo color size large 想要將值插入到自動編號 或者說是標識列,identity 中去,需要設定 set identity insert 示例 1.首先建立乙個有標識列的表 create table products id int identity primary...

linux mount 與umount 學習心得

要將檔案系統掛載到我們的 linux 系統上,就要使用 mount 這個指令 用法 mount tonl 裝置名稱代號 掛載點 mount a 引數 a 依照 etc fstab 的內容將所有相關的磁碟都掛上來!n 一般來說,當我們掛載檔案系統到 linux 上頭時,linux 會主動的將 目前的 ...

心形函式 封心

這個是 html5實驗室 canvas世界 中的乙個例子,最大的收穫當然是心形函式 x 2 y 2 1 x 2 y 3 0。有了前面幾個動畫做鋪墊,這個還是比較容易就完成了,沒有遇到什麼奇特的問題。不過也因為比較輕鬆,的組織不是很認真,也不想去改了。值得一提的是這個動畫很容易另行發揮,我在除錯的過程...