.net6中的MVC架构
基本上,我想遵循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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您所写的内容,您有几个选择。
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.