摘要:原文:http://www.cnblogs.com/zhw511006/archive/2009/12/06/1617956.html1.MVC教程首页http://www.asp.net/learn/mvc/?lang=cs2.MVC概况2.1创建一个基于数据库的"电影"web应用http://www.asp.net/learn/mvc/tutorial-21-cs.aspx2.2MVC执行过程http://www.asp.net/learn/mvc/tutorial-22-cs.aspx2.3理解Models(模型),View(视图),Controllers(控制器)h
阅读全文
摘要:例1:>Model中体现1对多>DbContext两个表都已声明>Controller中使用Include("表名")即可//效果示意:例2:显示Album表字段 关联到 Genre和Artist字段
阅读全文
摘要:(1)protected The protected keyword is a member access modifier. A protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declared this member. //proteted修饰的方法 (本类 和 派生类 内部可访问)class A { protected int x = 123;}class B : A {..
阅读全文
摘要:七、使用EF快速完成CRUD功能(1)新建Artist,Genre,Album3个类,用属性显示3张表的关联(2)添加DbContext类(对应数据库),添加DbSet<Model>(对应表)>画出数据库设计图(表、表间关系),手动、UML、SQL的工具均可>添加Album、Genre、Artist类,和DbContext类 public class DbMusicContext:DbContext //相当于数据库 { public DbSet<Album> Albums { get; set; } //Album表 public DbSet<Gen
阅读全文
摘要:一、Url映射到Controller ActionResult(Method)(1)添加StoreController public class StoreController : Controller { // // GET: /Store/ //public ActionResult Index() //{ // return View(); //} public string Index(string name) //...
阅读全文
摘要:原因:启动调试Development Server已经启动。解决方式:停止右下角的Development Server,重新生成. F5
阅读全文
摘要:Razor cshtmlRazor cshtmlRazor即cshtml,是MVC的视图设计引擎.view 目录下的 _ViewStart.cshtml @{ Layout = "~/Views/Shared/_Layout.cshtml";}指定模板页 (即把_Layout.cshtml作为母页)sample列表>MovieStorehttp://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model(3)index.cshtml (显示列表的Razor页)>
阅读全文
摘要:http://weblogs.asp.net/shijuvarghese/archive/2008/07/09/asp-net-mvc-vs-asp-net-web-form.aspx
阅读全文
摘要:http://blog.joycode.com/scottgu/archives/2010/07/20/116030.joyRazor 开发者 介绍Razor的特性
阅读全文
摘要:(1)生成。 确保System.Web.Mvc.dll在bin目录下(2)发布网站到文件系统(3)在IIS中为网站添加应用程序池(一个虚拟目录,一个应用程序池)(4)添加在默认网站下添加虚拟目录(5)转换为应用程序至此,部署完毕
阅读全文
摘要:MVC4 前件:visual studio10 sp1http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4(by Rick Anderson)Music Store (byJon Galloway)http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-1http://ofps.oreilly.com/titles/9781449320317/ch_Intro.html(600P
阅读全文
摘要:(1)DbContext (Entity FrameWork 5.0)(数据库的CRUD操作)(2)DbSet Represents a typed entity set that is used to perform create, read, update, and delete operations. DbSet is not publicly constructible and can only be created from a DbContext instance. (表的CRUD操作)
阅读全文