MVC中的模型是什么 [英] what is model in mvc

查看:188
本文介绍了MVC中的模型是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mvc中的模型是什么,并且在控制器或模态中完成凝结操作

what is model in mvc and curd operation done in controller or modal

推荐答案

我将假设您的意思是模型而不是模态(完全不同的东西).该模型表示您的数据存储,您应该通过模型而不是控制器来进行数据库更新.控制器应该只处理来自视图的输入并根据需要更新模型,然后将数据从模型传递到视图.
I''m going to assume you meant model and not modal (completely different things). The model represents your data store and you''re supposed to do your database updates via the model rather than the controller. The controller should just handle inputs from the view and update the model as needed, and pass data from model to view.


根据 ^ ]:
模型是应用程序的一部分,负责处理应用程序数据的逻辑.
通常,模型对象从数据库中检索数据(并存储数据).

模型对象是应用程序的一部分,它们为应用程序的数据域实现逻辑.通常,模型对象检索模型状态并将其存储在数据库中.例如,一个Product对象可能会从数据库中检索信息,对其进行操作,然后将更新后的信息写回到SQL Server数据库中的Products表中. 详细信息此处 [了解ASP.NET MVC(模型视图) Controller)初学者的架构 [ ^ ]

-KR
According to the W3C[^]:
The Model is the part of the application that handles the logic for the application data.
Often model objects retrieve data (and store data) from a database.

Model objects are the parts of the application that implement the logic for the application''s data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in a SQL Server database.
More info here[^]

Read this article as well : Understanding ASP.NET MVC (Model View Controller) Architecture for Beginners[^]

-KR


这篇关于MVC中的模型是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆