Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are the M and the V from MVC even needed in ASP.NET Web API?

I have a Web API application that uses one controller which returns data read from a file.

So all I'm using is the C (Controller) part of MVC. I have no Views, and I'm not using Models, either - I'm storing and retrieving the data to/from the App_Data folder.

I know this is a rather simple solution, but it seems that all I need is C, not MVC. Am I missing something?

like image 505
B. Clay Shannon-B. Crow Raven Avatar asked Dec 08 '22 00:12

B. Clay Shannon-B. Crow Raven


1 Answers

Model-View-Controller is a design pattern, to help structure applications that have a GUI. ASP.NET MVC is a framework that helps you build a web application according to this design pattern.

Web API has nothing to do with the MVC design pattern. It was developed separately, temporarily distributed under the same umbrella name and now an own framework altogether: http://www.asp.net/web-api

The fact that some project templates still create "Model" and "Views" directories in your project, means that you're using an outdated project template or one that's assuming you want MVC and Web API in one project.

like image 142
CodeCaster Avatar answered Jan 16 '23 19:01

CodeCaster