SQL Server Connection Strings for ASP.NET Web Applications

       数据库学习过程中,发现一个好的资源: https://msdn.microsoft.com/en-us/library/jj653752.aspx 

就是关于微软各种版本的数据库连接字符串的XML格式,还有连接字符串的每个关键字的解释,单击 Connection String Examples -->LocalDB Connection String Example,就跳转到LocalDB Connection String Example”部分的内容,而且下面还有如下提示:“For more information about connection string settings, see Data SourceAttachDbFileNameInitial CatalogIntegrated Security, andMultipleActiveResultSets later in this topic.”

     我现在终于明白了Initial Catalog等各个关键字的官方、准确、权威的定义 了!!,

即:Initial Catalog (synonym: Database)  initial catalog 在有道词典里查询也是“数据库”的意思;

Integrated Security (synonym: Trusted_Connection):信任链接,有三种赋值:True False SSPI (Security Support Provider Interface) ,具体解释你参照上述链接,下文有相关提示:“You have to use integrated security when you use LocalDB or the AttachDBFileName option. Otherwise,”。

MultipleActiveResultSets: (MARS) option makes it possible to execute multiple queries simultaneously. 具体参见上述网址的解释。

     注意当你使用localdb的时候,你添加到web.config里面的链接字符串的名字,必须和你的Model里面的MovieDBContext相同!!( name of the connection string must match the name of the DbContext class.),如链接字符串如下:

<add name="MovieDBContext"    connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True"   providerName="System.Data.SqlClient" />

      关于Localdb在 https://msdn.microsoft.com/en-us/library/hh510202.aspx有以下介绍:

The LocalDB setup program uses the SqlLocalDB.msi program to install the necessary files on the computer. Once installed, LocalDB is an instance of SQL Server Express that can create and open SQL Server databases. The system database files for the database are stored in the users' local AppData path which is normally hidden. For example C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\LocalDBApp1\. User database files are stored where the user designates, typically somewhere in the C:\Users\<user>\Documents\ folder.

For more information about including LocalDB in an application, see the Visual Studio documentation Local Data OverviewWalkthrough: Creating a SQL Server LocalDB Database, and Walkthrough: Connecting to Data in a SQL Server LocalDB Database (Windows Forms).


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值