Cezary Walenciuk Profile picture
Writing about C# and .NET My Friend
May 10, 2022 12 tweets 5 min read
Can you use CQRS pattern without MediatR or reflection ?

You can🤩

C# and dependency injection container is all you need

@oskar_at_net created 2 blog post and gave 2 talks about this. Power and credits to him🤘👨‍🎤

At first you need to create these interfaces. Then👇

#dotnet Then you create auxiliary extension methods that allow you to easily add Query and Command classes that implement these interfaces to Dependency injection container

Here is the code for AddCommandHandler extension method
Jan 25, 2022 6 tweets 3 min read
Let's see🤔

How can you control life cycle of injected elements in ASP..NET Core DI Container?

We have three live cycles:
➡️ Singleton
➡️ Scoped
➡️ Transient

How do they work? Here is the thread 🧵👇 with the demo and code

#dotnet #csharp #devcommunity Do to the demo, we need to create an interface per life cycle option.

An implementation of that interface will return a unique ID.
New ID means that element was recreated