no dogma blog
no dogma blog
Blog Posts
Podcast
Web API Lambda Course
Polly Course
Photos
Contact
Support this Site
About
RSS
Light
Dark
Automatic
Posts
HttpContent ReadAsAsync with .NET Core 2
Full source code available here. If you are used to using HttpContent.ReadAsAsync you might be surprised to learn that it is missing from .NET Core 2. You can try adding Microsoft.
Oct 12, 2017
#
dotNet Core
,
AspNet
,
ReadAsAsync
,
WebApi
Entity Framework Core 2 Unit Testing in .NET Core 2
Full source code available here. Unit testing Entity Framework used to be quite a chore, but over the past few years it has become significantly easier. In this post I’m going to show you how to use the InMemory database with named instances.
Sep 25, 2017
#
dotNet Core 2
,
Entity Framework Core
,
Unit Test
,
WebApi
Unit Testing .NET Core 2 Web Api
Full source code available here. Unit testing Web API controllers in .NET Core 2 is very easy. I have very simple GET and POST methods. 1[Route("api/[controller]")] 2public class ValuesController : Controller 3{ 4[HttpGet] 5 public async Task<IActionResult> Get() 6 { 7 // imagine some db logic 8 List<string> values = new List<string>() { "value1", "value2" }; 9 return Ok(values); 10 } 1112[HttpPost] 13 public async Task<IActionResult> Post([FromBody]string value) 14 { 15 // imagine some db logic 16 return Created("", value); 17 } 18} Add an xUnit Test Project to your solution.
Sep 9, 2017
#
dotNet Core 2
,
Unit Test
,
WebApi
Multiple Get Methods with the Action Method Selector Attribute in .NET Core
Full source code available here. In .Net Core Web Api it is not possible for the routing mechanism to distinguish between the following action methods. public string GetSomething(int id, int something) and public string GetAnother(int id, int another)
Aug 15, 2017
#
dotNet Core
,
AspNet
,
Routing
,
WebApi
Web Api Routing in .NET Core
Full source code available here. Routing in .NET Core Web Api (1.1 and 2) is a little different than in earlier versions. I’ve written about this a few times, you can find those posts here.
Jul 15, 2017
#
dotNet Core
,
AspNet
,
Routing
,
WebApi
Fluent Validation in ASP.NET Core
Full source code available here. I have written about Fluent Validation a couple of times. There is a new library available for .Net Core. How to return to validation messages back to the caller is not immediately obvious.
Jun 7, 2017
#
dotNet Core
,
AspNet
,
Fluent Validation
,
WebApi
Returning default values from a failed web request with Polly Fallbacks
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. In previous posts on Polly I showed how to use a simple retry, and a retry with a delegate that is called before the request is retried.
May 25, 2017
#
AspNet
,
Polly
,
Web Service
,
WebApi
,
WebApi2
Re-authorization and onRetry with Polly
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. In a previous post I showed how to use Polly to make a simple call, retrying in the event of failure.
May 8, 2017
#
AspNet
,
Polly
,
Web Service
,
WebApi
,
WebApi2
Letting a request fail with Polly
Want to learn more about Polly? Check out my Pluralsight course on it. Polly is fantastic for transparently retrying a request but there is always a point at which you must give up.
Apr 19, 2017
#
AspNet
,
Polly
,
Web Service
,
WebApi
How to install .NET Framework 4.7 in Visual Studio 2017
Microsoft just released .NET Framework 4.7, but surprisingly it is not the easiest to install. Here are the steps for Windows 10, as of this writing, it is not available for earlier versions for of Windows.
Apr 13, 2017
#
dotNet Framework 4.7
,
Visual Studio 2017
«
»
Cite
×