Resolve all using mine

A couple of months ago I’ve started working on a simple CRUD service. A mix of ASP Core for REST API with Dapper for Database access - probably one of the most popular stacks for this kind of application. Very quickly it turned out that it’s more complex than I expected and this “simple-boring” CRUD became more interesting and challenging. The Problem 🔗︎ One of the first problems that I came across was that I had a lot of types that looked very similar but had some differences and served different purposes, like: ... Read More

Improving non-nullable reference types handling
, Author: Cezary Piątek

A few weeks ago I started using non-nullable reference types - a new C# language feature which was shipped with version 8.0. It wasn’t a completely new experience for me, because I was working before on projects that were heavily utilizing [NotNull] and [CanBeNull] Resharper annotations. The way how non-nullable types are handled by Roslyn seems to be a little more complex in comparison to Resharper - there are around 40 different diagnostics related to this area. ... Read More

Immutable types in C# with Roslyn
, Author: Cezary Piątek

Some time ago I came across Jimmy Bogard’s article “Immutability in DTOs?" about the pros and cons of using immutable type pattern/approach. I fully agree with the author - the idea of immutable types is great but without the proper support from the language syntax it might not be worth applying. C# allows creating immutable types by adding readonly keyword to fields or by removing setter from properties. We are obligated then to initialize those readonly members from the constructor or directly in the member’s definition. ... Read More

Setting assembly and nuget package metadata in .NET Core
, Author: Cezary Piątek

The new csproj format introduces two major changes that are important from the artifact metadata management perspective. First of all, a NuGet package definition was moved into the project file which allows sharing common attributes between NuGet package manifest and assembly info. Secondly, a new mechanism for generating source code of assembly metadata attributes was added, which shares some benefits from the first feature as well as simplify how these values can be overridden during the build process. ... Read More

How to simulate AutoMapper that works during the build time
, Author: Cezary Piątek

Almost two years ago I created the very first version of MappingGenerator. Since then, I’ve put a lot of work in this project, adding new functions and improving the mapping generation algorithm with 14 releases (43 issues/feature requests closed) in the meantime. With over 5.5k downloads from the marketplace and 380 stars on Github, it looks like there is quite a market demand for this kind of tool (even though my coffee button statistics indicate something different). ... Read More