Reputation: 5866
I am very new to MVC4 and try to learn everything by doing a simple project. I created a model and a control succesfully. But I couldnt understand where it stores its database.
I can do insert,delete,update records on webpage created by ASP.NET, but I cannot locate where that database is. I checked the web.config but there is no connection string. how can I find out where the system stores its data?
I have sql-server installed on my computer but I checked it and it is not stored there
Upvotes: 0
Views: 167
Reputation: 18387
Global.asax.cs:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
// Use LocalDB for Entity Framework by default
Database.DefaultConnectionFactory = new SqlConnectionFactory(@"Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
Upvotes: 0
Reputation: 34905
MVC4 stores the database in an mdf
file located in your App_Data
folder. The connection string is available in the top-level web.config
.
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MvcApplication6-20130610160316;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MvcApplication6-20130610160316.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
Upvotes: 3