惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
A
About on SuperTechFans
Vercel News
Vercel News
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
V
Visual Studio Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
美团技术团队

博客园 - TT.Net

netcore使用IdentityServer在nginx下502错误的解决 更新到.netcore3.0后找不到dotnet-ef的解决办法 openssh-win64 on windows2016 ssh pub key config 405 Method Not Allowed error with PUT or DELETE Request on IIS Server minikube windows hyperx填坑记 angular当router使用userhash:false时路由404问题 内网gitlab11.2升级至11.4.5 Angular7上手体验 - TT.Net - 博客园 基于IPagedList 的 Asp.Net MVC 分页 asp.net mvc + JqueryValidate(二) Asp.net MVC +JQueryValidation + AjaxForm 自己用的一个ASP.Net MVC分页拿出来分享下 Microsoft MVC Preview 2 ActionFilterAttribute实际开发中的应用 [转]A Templated ASP.NET RSS Feed Reader Control ASP.NET MVC preview 1升级到ASP.NET MVC preview 2的一些更改 Microsoft ASP.NET MVC中Membership登陆的实现 今天遇到一个非常奇怪的问题 评:C#中一个字符串重复N倍的方法 常用的匹配正则表达式和实例
ASP.NET MVC 3 Preview 1 发布
TT.Net · 2010-07-28 · via 博客园 - TT.Net

早晨起来就看到群里的同志在说mvc3发布,真是快啊,前几天还在看razer的介绍呢,说要在新的MVC3里面加入默认的ViewEngine引擎的选择支持

mvc 3 p1下载地址是

http://www.microsoft.com/downloads/details.aspx?FamilyID=cb42f741-8fb1-4f43-a5fa-812096f8d1e8&displaylang=en

介绍里是说只能VS2010安装

一边写一边安装,这一次没有要求把前面的 MVC2 删除以后再安装

image

Visual stuido 2010 Tools 大概就是razer引擎的提示功能吧。

razor的介绍请典典的文章,真的不错

http://www.cnblogs.com/chsword/archive/2010/07/10/razor_in_aspnet_mvc_2.html

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.

大概安装了5分钟左右,完成

image

选择看了下Release Notes,还是比较长的。先不看了,新建工程看看!

image

MVC 2和MVC 3都有选择,而且默认有2种引擎可选

这里就来新建一个Razor的吧

同样它也有选择是否加入测试项目

image

Ctrl+F5先运行一下看看

image 

还是和原来一样的样式

打开View中的index.cshtml,先失望,没有自动提示,连cshtml都没有加入到html编辑器,自己添加一下,希望奇迹出现

image

同样也没有提示。不知道是不是因为我前面装过某些东西而这样,先看别的新功能吧

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();
        }
    }
}

这里可以看到

 image

新来了一个同志叫ViewModel,估计以后要常和他打交道,终于前台可以像用弱类型一样用了

 image

我们来新建几个试试,当然这个也是有一些关键字不能设置了

 image 看来也不能用中文,编译出错

错误    1    “System.Web.Mvc.ViewDataDictionary”不包含“好啊”的定义,并且找不到可接受类型为“System.Web.Mvc.ViewDataDictionary”的第一个参数的扩展方法“好啊”(是否缺少 using 指令或程序集引用?)

 image

加到前台去看看

 image

image

看来ID不是关键字新建一个ActionResult Test1 右键 => Add View

 image

image

再来同样建一个PartialView试试

image

设为ChildActionOnly,放到Index 去试试看

<p>@Html.Action("Test2")</p>

image

正常运行了

先写到这吧。有些功能在Release Notes里有图文介绍了我也不再去抄了