c# - How to create Discriminator column in Database First -


i have database first approach application , entity framework. have base class many other classes inherit. trying save class ef database, however, keep getting error there no discriminator column.

system.data.sqlclient.sqlexception: invalid column name 'discriminator'.

since using database first, how manually create column in table? cannot seem find datatype of anywhere.

the entity framework try check column in of derived classes (isn't inheritance about?). can try adding [notmapped] attribute child classes.

[notmapped] public class childclass : parentclass {     // other stuff here } 

this minimize problem. attribute tells entity framework of properties (if applied fields) or classes not need mapped. read more it: https://msdn.microsoft.com/en-us/data/jj591583.aspx?f=255&mspperror=-2147217396#notmapped


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -