Tag Enterprise
EF Core 2.1 vs NHibernate 5.1: DDD perspective
UPDATE 3/5/2020: I’ve expanded on this article and updated its content for EF Core 3.1 in my new Pluralsight course DDD and EF Core: Preserving Encapsulation.
That was probably a long wait for those of you who follow my blog. But, better late than never, so here it is: another comparison of Entity Framework and NHibernate, in which I bash EF Core and present it as an unbiased review. Just kidding, I do try to be unbiased here to the best of my skills.
Code review: User Controller and error handling
This is the first code review where I showcase some real-world code example and nitpick suggest improvements in it. If you want to learn more about this new format, check out this post. You can also request a review yourself. To do that, use the form on this page. Code review: User Controller and error handling The code in question is a UserController class with this Create method: publicIActionResult Create([FromBody] UserCreateModeluser)
OCP vs YAGNI
In this post, I want to cover the topic of OCP vs YAGNI - contradictions between the Open/Closed Principle and the You aren’t gonna need it one. OCP Let’s start with a refresher for what OCP is. The Open/Closed principle states that: Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. It was first introduced by Bertrand Meyer in his canonical Object-Oriented Software Construction book.
7 notable NDC London 2016 talks
This post is a review of some talks from NDC London 2016 that I found interesting.
Early exit is a tail call optimization of procedural languages
A couple of days ago, a nice analogy came to mind which I thought would be an interesting one to share: early exit is essentially a tail call optimization of procedural languages. Let’s see how it is so.
C# and F# approaches to illegal state
You have probably heard of such phrase as “make illegal states unrepresentable” already. Basically, it stands for using some set of techniques for dealing with illegal states in your domain model. In this post, we’ll look at how C# and F# allow us to handle them.
3 misuses of ?. operator in C# 6
I guess you already know about the safe navigation operator (?.
operator) coming up in C# 6. While it’s a nice syntactic sugar for quite a few cases, I’d like to point out some misuses of it I’m sure we will see when C# 6 is released.
C# Read-Only Collections and LSP
I often see programmers saying that .NET read-only collections violate Liskov Substitution Principle. Do they? The quick answer is no but let’s go through the whole story first.
CQS with Database-Generated Ids
Mark Seemann brings up a very interesting subject in his post: how to fit Command Query Separation principle in case you have to save a brand-new object in a database and also need the created id back? Sure, you can have GUIDs for identifiers (which have some drawbacks as I’ll show later on), but what if you really need integers? I’ve been asked the same question for several times, so in this post I’ll share the solution I use for this problem.
Entity Base Class
If you follow DDD principles, you eventually end up creating a base class for all the domain entities. It’s a good idea as it allows you to gather common logic in one place. When you decide to do that, you inevitably face the question of what exactly should be included in that base entity and how it should be presented.