EF Core Mapping EntityTypeConfiguration

后端 未结 15 1236
花落未央
花落未央 2020-11-30 18:26

In EF6 we usually able to use this way to configure the Entity.

public class AccountMap : EntityTypeConfiguration
{
    public AccountMap()
           


        
15条回答
  •  失恋的感觉
    2020-11-30 19:10

    In ef core we have to impelement IEntityTypeConfiguration instead of EntityTypeConfiguration in this case we have full access to DbContext modelBuilder and we can use fluent api but in ef core this api is a litle bit diferent from previous versions. you can find more details on ef core model configuration on

    https://www.learnentityframeworkcore.com/configuration/fluent-api

提交回复
热议问题