VS provides a lot of handy tools for SQL Server Object Manager to access the database directly in VS, without having to open a management Studio. The use of the SQL Server Object Manager is documented here.
1. Locate the SQL Server Object Manager in the view first
2. The right sidebar of VS will appear.
We first link a localdb, right-click on SQL Server to select Add SQL Server
The following dialog box appears, filled in (LocalDb) \v11.0, using Windows authentication. This will show all the localdb below the machine.
This is the link string from MVC webconfig connectionstring= "Data source=(LocalDb) \v11.0; Initial catalog= Aspnet-ef-20150303094817;integrated Security=sspi; attachdbfilename=| Datadirectory|\aspnet-ef-20150303094817.mdf ".
Oddly enough, AttachDbFileName is Aspnet-ef-20150303094817.mdf, in MVC4 's project App_Data file, the database name is EF.Models.VetContext.mdf. Aspnet-ef-20150303094817.mdf was not found in the C drive and the project, but the actual operation was EF.Models.VetContext.mdf. They should have some kind of mapping.
<Addname= "DefaultConnection"ProviderName= "System.Data.SqlClient"connectionString= "Data source= (LocalDb) \v11.0;initial catalog=aspnet-ef-20150303094817;integrated Security=sspi; attachdbfilename=| Datadirectory|\aspnet-e F-20150303094817.mdf " /> <Addname= "Ceentities"connectionString= "Data source=| datadirectory| Db.sdf "ProviderName= "system.data.sqlserverce.4.0" />
<Addname= "SqlConnection"connectionString= "Data source=rj-stone-pc;initial catalog=support;integrated security=false; Persist Security Info=false; User Id=sa; Password=sa "ProviderName= "System.Data.SqlClient" /> </connectionStrings>
The link strings for SQL Server and CE are needless to say. Initial Catalog represents the database name. Security Info Indicates the login method, and False indicates that SA login is required. True or SSPI is a Windows login without authentication.
The wonderful is that I modified the name of AttachDbFileName to attachdbfilename=| The datadirectory|\ef.mdf,app_data did not create a new ef.mdf, and the data was updated in EF.Models.VetContext.mdf after the initial catalog was changed to the EF run program.
<name= "DefaultConnection" providerName= "System.Data.SqlClient" connectionString= "Data source= (LocalDb) \v11.0;initial catalog=ef;integrated Security=sspi; attachdbfilename=| Datadirectory|\ef.mdf "/>
This phenomenon makes me a little bit sleepless.
The same can be used to load the local SQL Sever database.
In addition, VS has a server Explorer that comes with it to open the database. But not the top of the use. When the database begins to be linked, he cannot successfully link to the database and needs to be closed for other use links. There is no difference between the access capabilities of the database.
Use of the SQL Server Object Manager