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

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();
        });

posted @ 2022-11-08 18:13  ChuckLu  阅读(1013)  评论(0)    收藏  举报