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
Using the Polly Timeout when making a Http Request
Full source code available here. Want to learn more about Polly? Check out my Pluralsight course on it. When making remote service requests the remote side will sometimes take longer than acceptable to respond.
Dec 5, 2017
#
Polly
,
WebApi
,
Web Service
Unit testing Entity Framework Core Stored Procedures
Full source code available here. Entity Framework Core has made unit testing CRUD functions much easier, see here for an example of using the In Memory Database, it allows you to search, add, remove and update rows.
Nov 21, 2017
#
Entity Framework Core
,
Stored Procedure
,
Unit Test
Reusing HttpClient with Dependency Injection
Full source code available here. If you are using HttpClient to make requests for you, you might have come across some articles discussing how to reuse HttpClient. They strongly advocate for using a single HttpClient for as many requests as possible, i.
Oct 28, 2017
#
dotNet Core 2
,
AspNet
,
Dependency Injection
,
HttpClient
,
WebApi
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
«
»
Cite
×