.net6中的MVC架构

发布于 2025-02-13 08:11:31 字数 129 浏览 1 评论 0原文

基本上,我想遵循MVC架构。因此,我应该将ASP.NET Web API或ASP.NET MVC用于后端开发吗?

ASP.NET Web API是否具有MVC架构?如果确实帮助我使用.NET 6中的MVC架构构建Web API。

Basically I want to follow MVC Architecture. So should I use Asp.Net Web Api or Asp.Net MVC for backend development?

Does Asp.Net Web Api have MVC architecture? If does help me build Web Api using MVC Architecture in .net 6.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界如花海般美丽 2025-02-20 08:11:31

根据您所写的内容,您有几个选择。

MVC是一种前端设计模式。对于后端开发,您可以创建一个Web API项目,该项目将使您能够创建类似于MVC的模型和控制器。您不会使用Web API创建视图,因为没有UI。

另外,尤其是如果这是一个不关心的较小项目,则可以创建代表整个应用程序的MVC项目,并在此处包含后端代码,而不是创建单独的后端项目。在这种情况下,您将拥有驾驶UI的型号和控制器,而不是后端。

Based on what you've written, you have a couple options.

MVC is a front-end design pattern. For backend development, you could create a Web API project, which would give you the ability to create models and controllers similar to MVC. You would not create views with Web API as there is no UI.

Alternatively, and especially if it's a smaller project where scalability is not a concern, you could create an MVC project representing the whole app and include the backend code there rather than creating a separate backend project. In this case you'd have models and controllers driving the UI, but not the backend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文