C# Pipeline Handler & Logger

I have created a demo project for log handler and TryCatch wrapper (http://kenanhancer.com/2018/06/26/c-trycatchwrapper-and-logging/_.

I need a logger which can write to console and file at the same time. So, I created this demo which creates logger pipeline dynamicly. When code runs, it will write message in console and FileLog.log file at the same time.

C# LocalDataStoreSlot, ThreadStatic, and ThreadLocal To Pass Thread Specific Data

Every thread will have isolated data. I try to show that concurrent web requests are coming to Controller classes and different data is passed to the threads. Lastly, don’t use with async/await, it is not working properly.




C# Asynchronous Programming Patterns

There are 3 Asynchronous Programming Patterns in C#.

1- Asynchronous Programming Model (APM)
2- Event-based Asynchronous Pattern (EAP)
3- Task-based Asynchronous Pattern (TAP)


1- Asynchronous Programming Model (APM)

Asynchronous Programming Model using Delegates

you can reach that article from Calling synchronous methods asynchronously

2- Event-based Asynchronous Pattern (EAP)

3- Task-based Asynchronous Pattern (TAP)

Chain of Responsibility Pattern and Aspect Oriented Programming

Each class contains only the business logic code, while the aspects will be responsible of intercepting the code in order to inject the cross-cutting concerns.

This is first version of example code.

This is second version. You can find MethodInfo and parameter values in the aspect classes.

C# and RabbitMQ PubSub Example

Before you run the following C# code, run the below docker code to have a RabbitMQ applicaton locally.

docker run -d –hostname my-rabbit –name some-rabbit -p 8080:15672 -p 5672:5672 rabbitmq:3-management

After run Docker RabbitMQ container, you can reach from http://localhost:8080/ as shown in following picture.