5 ms·
This is not new, really. This is just a different name for the Controller in ASP.NET MVC model. We've been doing this even with ASP.NET MVC 2, i.e. expose REST
by ttran 15y ago
This is not new, really. This is just a different name for the Controller in ASP.NET MVC model. We've been doing this even with ASP.NET MVC 2, i.e. expose RESTful APIs, or any public functions of our controllers, which return JSON data or any primitive data type.
The process to create a Web API class is identical to the process to create a ASP.NET MVC controller class, that is:
- create a class
- create public functions
- set the route
It's nice make the controller role stand out and have its own name (Web API), however, I feel a bit disappointed if Microsoft touts this as a big feature of the next Visual Studio and .NET Framework.
- darrenkopp 15y agoYup. Not new at all. MVC has always been able to automatically change it's output based on the Accept header that was passed in on the request. MVC has always been able to be self hosted in something like a console application or windows service so you didn't have to use IIS. Oh wait, no it doesn't. I guess you could say this is a completely new product that uses a lot of the same patterns as MVC, but ultimately does things very differently.
- euroclydon 15y agoPlease show me where this or a previous version of ASP.NET MVC can be hosted in a console app?
- darrenkopp 15y agoIt can't. That was sarcasm. My point was that Web API does a lot of things MVC can't.
- euroclydon 15y agoOk, well the article didn't mention non-IIS hosting either unless I missed it.
- darrenkopp 15y agoit's there for Web Api, article may not mention it though.
- deleted 15y ago[deleted]