Recently I wrote about the use of unitofwork mode and repository mode in Nhibernate:
For more information, see:Http://www.cnblogs.com/n-pei/archive/2011/01/11/1933389.html.
The second part will be shared over the weekend.
Today, I would like to share with you the razor syntax. After all, in Asp.net MVC 3, The Asp.net MVC team always recommends that you use the razor engine, in addition, many of its advantages make more and more developers like it.
Razor's blogArticle:
Http://www.cnblogs.com/sl21100/archive/2010/11/17/1879925.html
Http://www.cnblogs.com/facingwaller/archive/2010/12/04/first_time_to_use_razor_in_mvc3.html
Http://www.cnblogs.com/hjf1223/archive/2010/12/16/mvc3-razor.html
I will share with you the information I have seen on the official Asp.net website and the grammar I have learned.
1. Using the @ symbol, you can directly write C # Or VB on the HTML pageCode:
After running:
2. the C # Or VB code on the page is enclosed in braces.
After running:
3. Each line of code ends with a semicolon:
After running:
4. Output special characters, double quotation marks, and slashes on the page:
Running effect:
5. Obtain the URL and requesttype of the current page through the request attribute.
Running result:
6. Use if --- else:
In this scenario, we determine whether the current browser will post data to the server. If post is used, we will prompt you to click the post button.
After running:
The following is a complete example:
After you click the submit button, @ totalmessage is the sum of the input text1 and text2.
Razor also has its own type conversion:
There are also annotations in razor. There are two methods -:
Good night.
To be continued ......