In previous versions of Entity Framework we could use
EntityTypeConfiguration<TEntity> to configure the mapping for the entity of type
TEntity on the constructor.
The other option is to set the mapping on the
OnModelCreating method of the
DbContext, but this other option is nice because we can leave each mapping in its own place.
Now I'm starting to use Entity Framework Core and I could not find the
EntityTypeConfiguration<TEntity> class, so I believe things have changed.
Is it possible to create a mapping class in the new version of Entity Framework or for now we have to use the
OnModelCreating is the preferred way to do it right now. The team (specifically rowanmiller) mentioned that:
I think we will probably do this, or something like it, but it is lower priority than some of the other features EF Core is missing at the moment.
If you read through the comments on that issue, there are some alternative ways to do it, but not "officially" supported ways other than
OnModelCreating right now.