首页 > 其他分享 >The entity type 'ExtraPropertyDictionary' requires a primary key to be defined.

The entity type 'ExtraPropertyDictionary' requires a primary key to be defined.

时间:2022-11-08 18:22:36浏览次数:35  
标签:defined primary ExtraPropertyDictionary entity key type

The entity type 'ExtraPropertyDictionary' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.

 

 

解决方案:

 modelBuilder.Entity<MyEntity>(entity =>
        {
            entity.HasKey(e => e.FuelExciseId);
            entity.ConfigureByConvention();
        });

标签:defined,primary,ExtraPropertyDictionary,entity,key,type
From: https://www.cnblogs.com/chucklu/p/16870727.html

相关文章