EF Core Migrations doesn't pick up all properties

Viewed 1522

When using EF Core Migrations the tooling isn't picking up all my properties, only the "Id" and some (not all) of the FK's (navigation properties). It also seems to understand the "Table Per Hierarchy" very well - as it has set up a discriminator where I wanted it to, but the migration file itself doesn't reflect the properties I have in my Model namespace (see github code).

My DbContext are located here: https://github.com/aredfox/TheConference/blob/master/InfoBooth/TheConference.InfoBooth.Data/InfoBoothContext.cs My Model classes here: https://github.com/aredfox/TheConference/tree/master/InfoBooth/TheConference.InfoBooth.Core/Model

You can look at the generated "Initial Migration" at [ https://github.com/aredfox/TheConference/blob/master/InfoBooth/TheConference.InfoBooth.Data/Migrations/20170604125116_Initial.cs ]. There you'll see that it detected all the Id properties (defined in the base class [Entity][1]), but none of the other properties I of my Model classes.

I used the approach of adding a Console App to run migrations (otherwise it won't work - see Julie Lerman's tips on getting started with EF Core). Thus when running migrations I do it this way: dotnet ef --startup-project ../../TheConference.Infrastructure.ConsoleApp migrations add Initial.

Do I have to use annotations or modelBuilder or a form of EntityTypeConfiguration in EFCore to let EF know what I want to take?.

1 Answers
Related