Last week, I posted a guide on upgrading Angular 6 app to Angular 7. But, what if you wish to create Angular 7 app from scratch with VS 2017? At the time of writing this post, default ASP.NET Core SPA templates allow you to create Angular 5/6 based app with Visual Studio without installing any third-party extensions or templates. This post talks about how to create an Angular 7 App with Visual Studio 2017. (more…)
Today there are no tools built into Visual Studio to test WEB API. Using browsers, one can only test http
GET requests. You need to use third-party tools like Postman, SoapUI, Fiddler or Swagger to perform a complete testing of the WEB API. In ASP.NET Core 2.2, a CLI based new dotnet core global tool named “http-repl” is introduced to interact with API endpoints. It’s a CLI based tool which can list down all the routes and execute all HTTP verbs. In this post, let’s find out how to use HTTP-REPL tool to test WEB API in ASP.NET Core 2.2.
ASP.NET Core 2.1 introduced the
APIController attribute which performs automatic model state validation and in case of an invalid model state, responds with a 400 bad request error. When the controller is decorated with
APIController attribute, the framework would automatically register a
ModelStateInvalidFilter which runs on the
OnActionExecuting event. This checks for the model state validity and returns the response accordingly. This is a great feature, but sometimes you want to return the custom error instead of the 400 bad request error. In such case, we should disable automatic model state validation.In this post, find out how to disable automatic model state validation in ASP.NET Core 2.1.
One of the new features of ASP.NET Core 2.2 is, API Controller conventions for better documentation experience. ASP.NET Core 2.1 introduced the
ApiController attribute to denote a web API controller specific conventions like performing automatic model validation and automatically responds with a 400 error. The ASP.NET Core 2.2 takes one step further to provide the metadata for API Explorer and a better end-to-end API documentation experience. To achieve this, ASP.NET Core 2.2 introduces API Analyzers which help in following a set of conventions for better API documentation. In this post, let’s find out how to use API Analyzers. (more…)
Creating query string in code can lead to errors as you have to deal with strings, ampersand and question marks. Fortunately, ASP.NET Core has a static class
QueryHelpers which has a function called
AddQueryString offers a neat way to build query string in ASP.NET Core. The
AddQueryString method has 2 definitions. One for creating query string for single parameter and another for multiple parameters. (more…)