ASP. net mvc 3 Preview 1 released)

Source: Internet
Author: User

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.

View Source

Print?

1 Using System;
2 Using System. Collections. Generic;
3 Using System. LINQ;
4 Using System. Web;
5 Using System. Web. MVC;
6   
7 Homecontroller. CS
View Source

Print?

01 Namespace Razortest. Controllers
02 {
03 Public Class Homecontroller: Controller
04 {
05 Public Actionresult index ()
06 {
07 Viewmodel. Message ="Welcome to ASP. net mvc! ";
08   
09 Return View ();
10 }
11   
12 Public Actionresult about ()
13 {
14 Return View ();
15 }
16 }
17 }

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.