I am getting this error
"The entity type 'DisplayFormatAttribute' requires a primary key to be defined." on the terminal when I try to run this code
Dotnet ef migrations add firstMigrationAddModels
I am creating a code first database migration using Entity-framework core 2.0
I have many models (Classes) and One class inherits from another, To solve that problem I used the Inheritance functionality of the Entity Framework core called Table Per Hierarchy (TPH)
https://www.learnentityframeworkcore.com/inheritance
I put both the derived and base class in Dbset of the dbcontext
public DbSet<Person> people { get; set; }
public DbSet<Student> students { get; set; }
The STUDENT class doesn't have PK because the Person has it.
I also have classes that have many to many relationships and I solved that by creating a bridge class
The error says I need the primary key inside "DisplayFormatAttribute" but I don't have access to that class
I am using DataAnotationAttributes like Maxlength() and minlength() in my models so I am accessing that class some how.
Other types I am using are PhoneAttribute,EmailAddressAttribute
[MaxLength(15)]
public PhoneAttribute Phone { get; set; }
[MaxLength(254)]
public EmailAddressAttribute Email { get; set; }