entity framework - Where is the LocalDB database stored? -


i wanted test multiple approaches in building app (db first, model first, code first). after using t4scaffolding , having lots of issues db post modifications, though ef not enough flexible. have found weird thing. left single 'defaultconnection' specified in web.config , pointing single .mdf file in app_data folder of solution. using code-first approach, i've created entities (classes), scaffolded repositories, context, seems work fine, except data stored before 'deleted' , updated db. but, after checking in vs server explorer, database contains tables used identity (users, roles), , shows me actual database somewhere else. suspect located @ 'c:\users{myuser}\appdata\local\microsoft\microsoft sql server local db\instances'. cannot open .mdf files there check, since in use. stuck. data???

forgot mention have 2 contexts in application, therefore receive warning in pm console: "more 1 context type found in assembly ...".

howerver, first 'applicationdbcontext' , refers identity db:

public class applicationuser : identityuser { }  public class applicationdbcontext : identitydbcontext<applicationuser> {     public applicationdbcontext()         : base("defaultconnection")     {     } } 

and second context bound single db connection web.config, , has business logic entities

it little weird. connection strings picked web.config , must there. please recheck. default ef creates database in app_data folder. can search folder. in case if find uncomfortable working multiple contexts, can copy dbsets applicationdbcontext, , should work fine.

edit: can specify same cs other context like:

namespace mvcproject  {          public class northwinddb : dbcontext          {                  public northwinddb() :              base("defaultconnection") {}     } }   

here while calling constructor of base class, can pass name of connection string. default identity uses defaultconnection , can set our context.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -