One of the key features of Microservices is the resilience to failures. In this blog post, we will aim to implement Circuit Breaker Pattern in our API Gateway. We would be using the Quality of Service (QoS) functionality exposed by Ocelot. Internally, Ocelot uses Polly library to implement Circuit Breaker. Timeout Failures from Downstream services As the first step, … Continue reading Circuit Breaker with Ocelot & Polly – Part 1
Author: Anu Viswan
Handling Cyclic References during Serialization
In the previous post, we discussed handling subtypes during protubuf serialization. In this post, we will continue with serialization and discuss the handling of cyclic references. We will look into how cyclic references could be addressed in 3 key types of serializations. JsonXmlProtobuf As an example of cyclic references, we will address the classic example … Continue reading Handling Cyclic References during Serialization
Protobuf – Handling sub-classes
In this blog post, we will look into how to handle subclasses or interface implementations during protobuf serialization. Consider the following class. [ProtoContract] public class Person { [ProtoMember(1)] public string FirstName { get; set; } [ProtoMember(2)] public string LastName { get; set; } } For serializing an instance of the above with protobuf-net, you could do … Continue reading Protobuf – Handling sub-classes
Backend For Frontend Pattern
In this blog post, we will discuss Backend for Frontend pattern. To be honest, I was a bit surprised and skeptical when I first heard about this pattern, but the more I thought about it, the more sense it made. So what exactly is the Backend For Frontend pattern. The Problem Consider a generic backend Web Api that … Continue reading Backend For Frontend Pattern
Automapper vs Mapster
AutoMapper is undoubtedly the most popular object to object mapping library used around and it wouldn't be a surprise to know if any of us, including yours truly, have even tried out alternatives. I recently tried out Mapster and was quite surprised by the results. Even they did mention their Github pages about being faster than Automapper, I honestly didn't believe … Continue reading Automapper vs Mapster
Anti Corruption Layer
Integration with legacy systems is often challenging. Quite often the legacy systems would be a playground of obsolete APIs and convoluted data schemes. In order to provide compatibility with the older system, the newer system often has to share some of these undesirable traits of the legacy systems and corrupt them. Usually, developers tend to … Continue reading Anti Corruption Layer
Implementing Mediator And CQRS in .Net 6 Web Api
In some of the previous posts, we visited the Mediator and CQRS patterns, understanding the benefits it brings to the table. In this blog post, we will look into implementing the Mediator and CQRS pattern in our .Net Core Web Api application. We would be using the Mediatr library by Jimmy Bogard for the implementation of the … Continue reading Implementing Mediator And CQRS in .Net 6 Web Api
Design Patterns : Mediator Pattern
There are two reasons I thought I should be blogging about the Mediator Pattern. Firstly, I wanted to continue with the series of different design patterns and principles, filling out the missing pieces. Secondly, I would like to write a blog entry on configuring the Mediator and CQRS on a Web Api sometime soon. But … Continue reading Design Patterns : Mediator Pattern
A2Z.Net : B – BackgroundService
Long-running background processes have been a need for long and for over the years, this has been accomplished in various approaches in .Net. With the introduction of Worker Service templates, it has become a lot easier to create asynchronous long-running background tasks that are supported across platforms and have inbuilt capabilities like Dependency Injection. The … Continue reading A2Z.Net : B – BackgroundService
Why is ForEach Iteration over List<T> faster than IList<T>
In this post, I would like to draw your attention to the performance implications when iterating over IList<T> and List<T> . First let us begin by writing some code to run our benchmark tests against. We will execute a simple foreach loop against IList<T> and List<T>. [Benchmark] [ArgumentsSource(nameof(IListCollection))] public void ForEachIList(IList<int> collection) { foreach (var item in collection) { DoSomething(item); } } … Continue reading Why is ForEach Iteration over List<T> faster than IList<T>