Notes:
EF appears column name ' discriminator ' is invalid;
The class is not joined to the database context and is also generated by the Data migration table;
This problem usually occurs when a base class is used to inherit the entity class;
Because of the inheritance of the Poco entity objects in code First, EF generates mapping views for all of the model classes referenced in the project and for the subclasses of those model classes in the DbContext. If the database does not have a corresponding table or field, you will get an error.
Workaround: simply precede the class with [notmapped], which means that the attribute or class should be excluded from the database mapping.
- [notmapped]
- public class Comment : mcomment
- {}
Note: EF appears with column name ' discriminator ' invalid, the class is not joined to the database context and is generated by the Data migration table