Tag NHibernate
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.
NHibernate supports .NET Core 2.0
Good news everyone! NHibernate 5.1 is released with the support of .NET Core 2.0 and .NET Standard 2.0.
Having the domain model separated from the persistence model
In this post, I’d like to write about a pretty common discussion in DDD circles: should one have the domain model separated from the persistence model? In other words, should you map your domain objects to the DB tables directly using an ORM or would it be better to use a separate set of Data Access Objects (DAOs) instead?
Do you need an ORM?
Do you need an ORM for your project given you use a relational database? And not just some lightweight like Dapper but a big one: NHibernate, Entity Framework, Hibernate? I’d like to address this question with this post.
Combining SQL Server and MongoDB using NHibernate
We often think that relational and NoSQL databases are somewhat incompatible. But what if we could use both within a single domain model? I’d like to show how to combine SQL Server and MongoDB together and discuss what benefits we could get from it.
Validation logic and NHibernate event listeners
Today, I’d like to discuss a particular case with validating input data using NHibernate event listeners.
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.