首页 > 代码库 > 让LinqToSQL使用Web.Config中的链接字符串(修改Settings.Designer.cs)

让LinqToSQL使用Web.Config中的链接字符串(修改Settings.Designer.cs)

 [global::System.Configuration.ApplicationScopedSettingAttribute()]        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]        [global::System.Configuration.DefaultSettingValueAttribute("Data Source=127.0.0.1;Initial Catalog=MatchDB;Persist Security Info=True;Us" +            "er ID=sa;Password=sa")]        public string  MatchDBConnectionString {            get {                    //下面这几句                var connstr = "MatchDBConnectionString";//web.config里的conn名                return System.Configuration.ConfigurationManager.ConnectionStrings[connstr].ConnectionString ??                    ((string)(this["MatchDBConnectionString"]));            }        }

 

让LinqToSQL使用Web.Config中的链接字符串(修改Settings.Designer.cs)