Skip to main content

Posts

Showing posts from September, 2017

Fluent mapping approach for EF Core

With the first release of EF Core, there wasn't any proper approach of fluent mapping of entities, in an easy manner for enterprises application where a lot of entities needs to be involved. You might have ended up with nasty or repeated codes. At that time only way was to compose mapping based on ModelBuilder and by using inline fluent mapping codes. Like in newer version EF Core 2.0 there had been a new release of  IEntityTypeConfiguration for the creation of mapping based on single entity and could be registered with  ApplyConfiguration  by passing a new instance of  IEntityTypeConfiguration object.   https://docs.microsoft.com/en-us/ef/core/what-is-new (Self-contained type configuration for code first) This is really good for big application as we can separate mappings based on each entity. In this article, we would see how to achieve similar functionality in EF Core 1.0 and this implementation is a bit cleaner than 2.0 built-in classes. So, in both of versions, this co