-
Notifications
You must be signed in to change notification settings - Fork 0
05 Change the Database Name
M. Fares edited this page Mar 12, 2018
·
1 revision
Q. How can I change the name of the database?
- Get the name of the connection string from the ApplicationDbContext constructor located in the /Models/IdentityModels.cs file
public ApplicationDbContext()
: base("DefaultConnection")
{
}- The connection string is stored in the Web.Config file in the root folder of the project
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20180304084410.mdf;Initial Catalog=aspnet-WebApplication1-20180304084410;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>- Change the Initial Catalog=MyDatabase and AttachDbFilename=MyDatabase
- When you start your application, a new database will be created without your data