Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Jquery UI error
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01618237
Message ID:
01618523
Vues:
32
>>>>Thanks for responding, but I think I will take Rick's advice and start over small. angular and web api with empty mvc project.
>>>
>>>One more thing: I would probably use MVC instead of Web API. Going forward in vNext there will be no WebAPI, just a combined version of MVC that handles both HTML views and API access. MVC works just fine for APIs and with a little customization you can build the same functionality like WebAPI with MVC as well (ie content negotiation, and raw result values).
>>
>>Hmm. Haven't really used it but the new 'unified' controller in MVC6 seems to take more from the old API controller than the MVC controller. And the MVC controller is pretty kludgy for data. I'd argue that knowing the current Web Api controller (using attribute routing, etc) would make migrating to MVC6 easier...
>
>
>No not really. YOu still have action results with MVC, but ActionResults are really more like an HttpResponseMessage. You can't return raw objects unless you build a custom filter that manages the result explicitly (which you can do with MVC 6 but couldn't do with MVC 5 due to that lack of type info).
>
>IAC, curious why you say it's kludgy for data? Granted there are improvements that can be made (and I've done some of that for my API interfaces as described here: http://weblog.west-wind.com/posts/2014/May/20/Creating-ASPNET-MVC-Negotiated-Content-Results ), but overall using MVC is pretty painless for services IMHO.

OK, 'kludgy' may not be the right word but I'm sure you'll agree that the web api is superior for data. When using the MVC controller you have to serialize every response yourself (and the MVC Json serializer isn't ideal). Web api handles that for you and the serializer/s to be used can simply be set in the configuration.
Add in attribute routing (which makes it far simpler to build a more conformant RESTful interface) and the fact that web api has no dependency on the asp.net pipeline and, to me, it seems a no-brainer choice.

OTOH, for SPA applications (which tend to be what you want with angular) the MVC controller brings little to the table - nearly all views can be static html; razor becomes almost irrelevant. And, if you do need dynamic html, then, just as it's possible to do data with MVC, you can return html from the web api.

My 2c :=}

>The biggest issue with the current version of MVC is that it's not async optimized, but MVC 6 will be all async.
>
>+++ Rick ---
>
>
>
>
>>
>>
>>>+++ Rick ---
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform