The Entity type 'Personal' is part of a Hierarchy, but does not have a discriminator value configured

Asked

Viewed 116 times

3

I am trying to generate Migrations using the command:

dotnet ef migrations add InitialMigration --context MyContext 

and the same is returning me the following message.

System.Invalidoperationexception: The Entity type 'Personal' is part of a Hierarchy, but does not have a discriminator value configured.

In my classes I own PessoaFisica and PessoaJuridica inheriting from Pessoa and Funcionario inheriting from PessoaFisica (public class Funcionario : PessoaFisica).

modelBuilder.Entity<Funcionario>()
.ToTable("Funcionario");
  • Put all these classes, including how map (settings) I still don’t know if it works on core, there are things that still don’t work!

1 answer

1

  • I am using Entityframework Core. I do not have Entity<>(). MAP<>()

  • Ok. So probably this is what’s missing: modelBuilder.Entity<Funcionario>() . Hasdiscriminator<string>("Type") . Hasvalue<Employee>("FUNC");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.