I am reviewing an existing ASP.NET MVC (5.2.3) EF (6.1.3) project.
The project uses ASP.NET Identity, and I reviewed the 2 connection strings in web.config, one for the ASP.NET Identity and one for EF. Both points to the same DB, I've successfully modified them to let's call "mydb" I've also reviewed the mydbModel.edmx project item.
When I run the project, the mydb automatically created with the ASP.NET identity tables in it (as expected), however the other tables (for entities defined in mydbModel.edmx) are not. No error message, except later the application does not find a table.
Further I found the following lines too, so I suppose it is definitely not Code First:
public partial class MyDbEntities : DbContext
{
public MyDbEntities()
: base("name=MyDbEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
Although I am working with EF since its advent, (mainly DB First) unfortunately I am not sure the other main methods and their variants.
What else should I examine to make sure what kind of concept the project is using, and how can I create the tables defined in model?
By the code you have posted it definitely looks like DB first because we will use DbModelBuilder
to configure entities in OnModelCreating
in Code First. Also Code first doesn't have any edmx file (we don't have any in our project).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With