asp.net-mvc - 命名 ASP.NET MVC 中存在的 3 种不同类型模型的约定是什么? ( Controller 输入、 Controller 输出和持久性)

标签 asp.net-mvc naming-conventions

命名 ASP.NET MVC 中存在的 3 种不同类型模型的约定是什么? ( Controller 输入、 Controller 输出和持久性)

Visual Studio 在 MVC 3 脚手架中为每个模型类添加了“模型”后缀,但我不确定这是不区分模型类型的好方法。

我想问的一个次要问题是如何命名这 3 种不同类型的模型。我不是进入 View 的模型称为 View 模型。持久化可以称为持久化模型。但是 Controller 输入模型呢?

最佳答案

我通常使用 *ViewModel 作为 Controller 输出模型,使用 *Form 作为 Controller 输入模型。

对于持久性(域模型/实体),我不使用任何特殊的命名约定。

关于asp.net-mvc - 命名 ASP.NET MVC 中存在的 3 种不同类型模型的约定是什么? ( Controller 输入、 Controller 输出和持久性),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6968823/

相关文章:

naming-conventions - 在函数和方法名称中使用 %

asp.net-mvc - HTTP 500,customErrors 重定向不起作用

c# - c# 中的 PayPal 结帐问题

api - 国标英语还是美式英语?

html - 与 BEM 类命名约定混淆。更深一层

java - 包中不能使用.in域名

asp.net-mvc - 将 WebAPI 和 MVC 项目发布到同一个 Azure 网站?

asp.net-mvc - ASP.NET MVC 2 : ViewData. Model.ExecuteResult 不存在

asp.net-mvc - Ajax 请求返回 HTTP 错误 500,使用 MVC 和 $.ajax 调用 POST?

c - 典型的 xstr 宏中的 "x"是什么意思?