Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(七)Models
2013-06-03 15:29
344 查看
我们在前面的博客中已经讨论了controller和View,接下来,我们来谈一下Models,Models通常被认为asp.net mvc构架里最重要的部分。因为它是包含程序所有逻辑的层,逻辑是所有的程序最难处理的部分。
如果只是从技术的观点来看的话,model只不过包含一系列类,在属性里公开数据,然后在方法里公开逻辑。model要么是“数据模型”或者“领域模型”,它的主要任务是管理数据。
下面是EBuy要用到的一个Auction类。
仅管,在接下来,我们可能还要在它上面添加其它的功能(比如说验证),但是它还是很有代表性的。 more kinds of classes (such as services and helpers) that all work together to make up the “Model” in “MVC.”。
如果只是从技术的观点来看的话,model只不过包含一系列类,在属性里公开数据,然后在方法里公开逻辑。model要么是“数据模型”或者“领域模型”,它的主要任务是管理数据。
下面是EBuy要用到的一个Auction类。
public class Auction { public long Id { get; set; } public string Title { get; set; } public string Description { get; set; } public decimal StartPrice { get; set; } public decimal CurrentPrice { get; set; } public DateTime StartTime { get; set; } public DateTime EndTime { get; set; } }
仅管,在接下来,我们可能还要在它上面添加其它的功能(比如说验证),但是它还是很有代表性的。 more kinds of classes (such as services and helpers) that all work together to make up the “Model” in “MVC.”。
相关文章推荐
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(五)Controller
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(二)
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(六)View
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(一)
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(三)Convention over Configuration
- mvcframeworkProgramming ASP.NET MVC-Fundamentals of ASP.NET MVC(四)Controller
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(四)Routing
- The Three Models of ASP.NET MVC Apps
- Programming ASP.NET MVC-Fundamentals of ASP.NET MVC(八)Putting It All Together
- (转)[翻译]ASP.NET MVC 3 开发的20个秘诀(十八)[20 Recipes for Programming MVC 3]:自动完成搜索
- Announcing the Release of ASP.NET MVC 5.1, ASP.NET Web API 2.1 and ASP.NET Web Pages 3.1 for VS2012
- [翻译]ASP.NET MVC 3 开发的20个秘诀(十六)[20 Recipes for Programming MVC 3]:站点移动化
- [翻译]ASP.NET MVC 3 开发的20个秘诀(十八)[20 Recipes for Programming MVC 3]:自动完成搜索
- Dependency Injection and Inversion of Control with ASP.NET MVC
- ASP.Net MVC – What are the uses of Display, DisplayName, DisplayFormat and ScaffoldColumn attributes
- ASP.NET MVC 五 Models中使用LINQ自动生成的实体类
- Visual Studio 2015打开ASP.NET MVC的View提示"Object reference not set to an instance of an object"错误的解决方案
- Programming asp.net笔记--第三章 Controls: Fundamental Concepts
- Programming ASP.NET MVC 4 - Chap01 - ASP.NET MVC 基础
- Using ASP.NET MVC with Different Versions of IIS