I’m using EF 5.0 Code First to develop an app with a number of relational db tables. This works great until I try to add a table without any relationship (stand alone). I need a number of these reference/lookup tables in my db. I code my classes just like the others but EF seems to ignore them and doesn’t create them. Is there something I need to tell EF that these should be built as stand alone? How? Any guidance is greatly appreciated.
Share
To get EF to create a table you need a
DbSet<T>in yourDbContext, assuming you have this it will create the table.The one caviat to this is that if you have a foreign key to something that isn’t in you context EF will also assume its part of the database and create it. I think this is the behavior you are seeing.