I wanted to test multiple approaches in building an app (DB first, Model first, code first). After using T4Scaffolding and having lots of issues to DB post modifications, I though EF was not enough flexible. Now I have found a very weird thing. I left a single 'DefaultConnection' specified in Web.Config and is pointing to the single .mdf file in App_Data folder of the solution. Using a Code-First approach, I've created my entities (classes), then scaffolded repositories, context, everything seems to work almost fine, except I get even data which was stored before I 'deleted' and updated the DB. But, after checking in VS Server Explorer, the database only contains Tables used for Identity (Users, Roles), and this shows me that the actual database is somewhere else. I suspect it is located at 'C:\Users{MyUser}\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances'. But I cannot open .mdf files from there to check, since they are already in use. I am stuck. Where is my data???
Forgot to mention that I have two contexts in my application, therefore I receive a warning in PM Console: "More than one context type was found in the assembly ...".
Howerver, the first is 'ApplicationDbContext' and it only refers to Identity DB:
public class ApplicationUser : IdentityUser
{
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
}
and the second context is bound to that single DB Connection from Web.Config, and it has the business logic entities