Helping your asp.net core web API behave!

Behaving API

We all have been around a couple of asp.net web API’s and it’s safe to safe that you can get productive pretty quickly with it, especially if you deploying it to an azure web app or already have an IIS to deploy to!

Sometimes also you inherit an API when you join a new project and the outlook doesn’t look too good. Endpoints that do not perform, different return status code for model validation and even more disparate information for exceptions and so on. 

The API is behaving badly! [slap on the hand!!!] I’ll share with you 3 approaches that helped me on the past to improve the API, giving you a quick way to identify slow endpoints, validating models and handling exceptions without need to change the controllers, relying on middlewares and on a global filter to achieve so.

You can find the full source code on this GitHub repo! 

behaving not being too slow!

This one is pretty handy if due it’s implementation on a middleware. If you try to put a timer/stopwatch inside your controller and you have one or more filters associated with the method, and your problem is on the filter itself, then you out on the cold.

Continue reading “Helping your ASP.NET Core API to behave”

Book Review: Clean architecture, by Robert martin

Buy Clean Architecture Book at Easons

I’ve just finished the excellent “Clean Architecture: A Craftsman’s Guide to Software Structure and Design” by the famous “Uncle Bob” Martin.

Still a very relevant book for 2020 with timeless principles of software development and architecture!

SOLID Principles

You probably saw a hundred or more implementation of the 5 solid principles:

  1. Single responsibility
  2. Open/Close
  3. Liskov substitution
  4. Interface segregation
  5. Dependency Inversion

What the book highlights is not only what they are, but also why and when would you use them. It’s easy to see why teams that adopted those principles became more productive with better collaboration between the team members.

Continue reading “Review: Clean Architecture”