Thursday, April 15, 2021

Description of the enumeration members in Swashbuckle

Swagger is a great thing! It allows us to easily see the API of our service, generate a client for it in different languages and even work with the service through the UI. In ASP.NET Core we have NuGet package Swashbuckle.AspNetCore for the support of Swagger.

But there is one thing I don't like about this implementation. Swashbuckle can show me descriptions of methods, parameters, and classes based on XML comments in the .NET code. But it does not show the descriptions of the enum members.

Let me show you what I mean.

Wednesday, January 22, 2020

Constant reservation and Git hooks using C#

Let me tell you a story. Once upon a time, there were two developers: Sam and Bob. They worked with a project where a database was. When a developer wanted to make changes to the database structure they had to create a step file stepNNN.sql, where NNN was some number. To avoid collisions of the numbers between different developers they had a simple Web application. Each developer before starting to write an SQL file should go to the application and reserve a new number for their modifications.

That was a time for Sam and Bob to make changes in the database. And Sam obediently went to the Web application and reserved number 333. But Bob forgot to do it. He just used 333 for his new step file. It happened that Bob was the first who committed his changes into the version control system. When Sam was ready to commit it appeared that step333.sql already existed. He contacted Bob, explained to him that step 333 was already reserved and asked Bob to fix the collision. But Bob answered:

- Hey, man. You know, my code is already in the 'master' branch, many developers already took it. And also it is already on production. Could you just fix your code instead?

Have you noticed it? The person who followed all the rules was the one who was punished. Sam had to change his files, modify his local database, etc. Personally, I hate such situations. Let's see how we can avoid it.

Monday, May 6, 2019

NLog: rules and filters

In Confirmit we use NLog library for logging in .NET applications. Although there is a documentation for this library, I found it hard to understand how the loggers work. In this article, I’ll try to explain, how rules and filters are used by NLog. Let’s start.

Thursday, January 10, 2019

Log level per request

Some time ago I was reading Technology Radar of ThoughtWorks. And there was a technique called "Log level per request". Here in Confirmit, we use logging widely. So I was wondering how to implement a similar solution. And now I'm ready to show you one possible implementation.

Monday, December 10, 2018

Integration of Cake build script with TeamCity

Cake is a great tool for organizing a delivery pipeline for your application. I like it because it lets me to write the pipeline using C#, the language I know well. The great property of Cake, PSake and other similar frameworks is that they allow as to use the same building script on a local development machine and on CI servers. Here I'll explain how to integrate Cake with TeamCity.

Wednesday, July 4, 2018

Gathering context information for logging

When you write messages to your logs, sometimes it may be useful to add context information. For example, if you write information about some error, you could also include input data in some form, to be able to reproduce the problem easily. Here I'll show how to gather this additional information.