From an early development age, I was taught, that duplication is a bad thing. Especially when it comes to storing data. Relational databases were invented to show data that relates to each other and be able to store them efficiently. There are even a few normalization rules, to be able to avoid data redundancy. We… Continue reading Why duplication isn’t always a bad thing in micro-services
Analyze code with NDepend
Recently I got my hands on NDepend, a static code analysis tool for .Net framework. Because it can work as a plugin for Visual Studio, it offers great integration with code and rapid results. So what it can do? Let’s see! Getting started To start working with NDepend you need to download it and install… Continue reading Analyze code with NDepend
Why sharing your DTOs as dedicated nuget package is a bad idea
I’m working in a solution, that has many micro-services and some of them share the same DTOs. Let’s say I have a Product dto, that is assembled and processed through 6 micro-services and all of them has the same contract. In my mind an idea emerged: Can I have a place to keep this contract… Continue reading Why sharing your DTOs as dedicated nuget package is a bad idea
Receive Service Bus messages in Service Fabric
This is one of the proof of concent that I did at work. The idea was to add another Service Bus application to an existing solution, instead of starting a whole new micro-service. It was a lot faster just to add another .net core console application, but setting up Service Fabric cluster always brings some unexpected… Continue reading Receive Service Bus messages in Service Fabric
Writing unit tests with NUnit and NSubstitute
Imagine you are a Junior .Net Developer and you just started your development career. You got your first job and you are given a task – write unit tests! Nothing to worry about, since you got me. I’ll show you how things are done and what are the best practices to follow. Introduction Writing unit… Continue reading Writing unit tests with NUnit and NSubstitute
Adding a log4Net provider in .net core console app
I recently was developing a console application in .net core, where I had to use log4net logging. In the standard asp.net core approach we can use:
1 2 3 4 |
public void Configure(IApplicationBuilder app, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) { loggerFactory.AddLog4Net(); } |
But that is asp.net core and I don’t want to reference that in my console app. In order to solve it, I had to implement my own Log4NetProvider,… Continue reading Adding a log4Net provider in .net core console app
Service Fabric Reliable Actors – is it faster then a regular micro-service approach?
Recently I’m diving into Microsoft actor model implementation – Service Fabric Reliable Actors. Apart from Microsoft Orleans, is another one worth looking into. Let’s start from the beginning. What is Service Fabric? It is many things and can be compared to Kubernetes: Simplify microservices development and application lifecycle management Reliably scale and orchestrate containers and… Continue reading Service Fabric Reliable Actors – is it faster then a regular micro-service approach?
Microsoft Orleans – is it fast?
Microsoft Orleans is a developer-friendly framework for building distributed, high-scale computing applications. It does not require from developer to implement concurrency and data storage model. It requires developer to use predefined code blocks and enforces application to be build in a certain way. As a result Microsoft Orleans empowers developer with a framework with an… Continue reading Microsoft Orleans – is it fast?
Managing ServiceBus queues, topics and subscriptions in .Net Core
From version 3.1 of Microsoft.Azure.ServiceBus it is finally possible to manage queues, topics and subscriptions in .Net Core. Let’s have a look at how we can use it in real life scenarios. Previously we would use sample code for getting a queue:
1 2 3 4 5 |
public IQueueClient GetQueueClient(string _serviceBusConnectionString, string _queueName) { var queueClient = new QueueClient(_serviceBusConnectionString, _queueName); return queueClient; } |
Using ManagementClient we can write much better code.
1 2 3 4 5 6 7 8 9 10 11 |
public async Task<IQueueClient> GetOrCreateQueue(string _serviceBusConnectionString, string _queueName) { var managementClient = new ManagementClient(_serviceBusConnectionString); if (!(await managementClient.QueueExistsAsync(_queueName))) { await managementClient.CreateQueueAsync(new QueueDescription(_queueName)); } var queueClient = new QueueClient(_serviceBusConnectionString, _queueName); return queueClient; } |
Now before getting a… Continue reading Managing ServiceBus queues, topics and subscriptions in .Net Core
Generic export of csv files
Once in a while, you get a task, that you need to generate an export file to the 3rd party system. It is popular when communicating with price comparer services, search services, adds services etc. So you need to generate csv file with almost the same data, but in a slightly different format. How to… Continue reading Generic export of csv files