When I got up early in the morning, I saw the comrades in the group talking about the mvc3 release. I was reading the introduction of Razer a few days ago. I said that I would like to add the default viewengine engine selection support in the new mvc3.
MVC 3 P1 is
Http://www.microsoft.com/downloads/details.aspx? Familyid = cb42f741-8fb1-4f43-a5fa-812096f8d1e8 & displaylang = en
This document only supports vs2010 installation.
Install the MVC2 file while writing. This time, you are not required to delete the MVC2 file before installing it.
Visual stuido 2010 tools is probably the prompt function of the Razer engine.
Razor IntroductionArticle, Really good
Http://www.cnblogs.com/chsword/archive/2010/07/10/razor_in_aspnet_mvc_2.html
Introduction to new features of mvc3 p1
New features:
- Add view dialog lets you select View engine,
- ASP. net mvc 3 has new view engine called Razor,
- Support for Global Action filters,
- Controllers and views support now new property called viewmodel that is dynamic,
- New action result types,
- Some Ajax and JavaScript improvements,
- Model Validation improvements,
- Dependency injection improvements.
The installation was completed in about 5 minutes.
I chose to read the release notes for a long time. Don't read it first. Create a new project!
Both MVC 2 and MVC 3 are available, and two engines are available by default.
Here we will create a new razor.
Similarly, it also has the option of joining the test project.
CTRL + F5 run it first
Still the same style as the original one
Open index. cshtml in the view. I'm disappointed. I didn't have an automatic prompt. I didn't even add cshtml to the HTML editor. I 'd like to add it myself.
There is no prompt. I don't know if this is because I installed something before. Let's look at other new features first.
Using system; using system. Collections. Generic; using system. LINQ; using system. Web; using system. Web. MVC; homecontroller. CS
Namespace razortest. controllers {public class homecontroller: controller {public actionresult index () {viewmodel. Message = "Welcome to ASP. net mvc! "; Return view () ;}public actionresult about () {return view ();}}}
Here we can see
A new comrade called viewmodel is coming. It is estimated that he will often deal with him later. At last, the front-end can be used like a weak type.
Let's create several new ones. Of course, some keywords cannot be set.
It seems that it cannot be used in Chinese. An error occurred while compiling.
Error 1 "system. web. MVC. viewdatadictionary does not contain the "good" definition and cannot be found. The acceptable type is "system. web. MVC. the extended method of the first parameter of viewdatadictionary is "good" (whether the using command orProgramSet Reference ?)
Add to front-end
It seems that ID is not a keyword to create an actionresult test1 right-click => Add View
Create a partialview again.
Set it to childactiononly and put it in index.
<P> @ html. Action ("Test2") </P>
Running properly
Write it here first. Some features are illustrated in release notes and I will not copy them anymore.