private static ConnectionStringElement GetConfiguration(string name) { ConnectionManagerConfigurationSection section = ConnectionManagerConfigurationSection.GetConfig(); ConnectionStringConfigurationElement configElement = section.ConnectionStrings[name]; ConnectionStringElement element = null; // 本地配置文件的连接串采用优先级高于Meta库中的 if (configElement != null) { element = new ConnectionStringElement(); element.ConnectionString = configElement.ConnectionString; element.ProviderName = configElement.ProviderName; element.EventArgsType = configElement.EventArgs.Type; element.Name = configElement.Name; element.CommandTimeout = configElement.CommandTimeout; } //else //{ // // 备选通道是从Meta库获取 // MetaConnectionStringConfigurationElement metaElement = section.MetaConnectionString; // if (metaElement != null) // element = metaElement.GetConnectionStringElement(name); //} return element; }
private static string ParseFromConnectionString(ConnectionStringElement element) { var s = (element == ConnectionStringElement.AccountName) ? "AccountName=" : "AccountKey="; var cs = RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"); cs.Replace(" ", string.Empty); var index = cs.IndexOf(s) + s.Length; var length = cs.IndexOf(';', index) - index; return((length > 0) ? cs.Substring(index, length) : cs.Substring(index)); }
private void SetConnectionString(string connstring) { if (AppConfigTemplate == null) { return; } ConnectionStringElement.SetValue(connstring); AppConfigTemplate.Save(AppConfigPath); }
private static string ParseFromConnectionString(ConnectionStringElement element) { return ""; }
/// <summary> /// Initializes a new instance of the <see cref="ConnectionStringElementPropertyDescriptor"/> class. /// </summary> /// <param name="connectionStrings">The connection strings.</param> /// <param name="connectionString">The connection string.</param> public ConnectionStringElementPropertyDescriptor(ConnectionStringElementCollection connectionStrings, ConnectionStringElement connectionString) : base(connectionString.Name, null) { this.connectionStrings = connectionStrings; this.connectionString = connectionString; }
private static string ParseFromConnectionString(ConnectionStringElement element) { return(""); }
private static string ParseFromConnectionString(ConnectionStringElement element) { //sl-king //uses azure but it is unused return(""); }
private static string ParseFromConnectionString(ConnectionStringElement element) { var s = (element == ConnectionStringElement.AccountName) ? "AccountName=" : "AccountKey="; var cs = RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"); cs.Replace(" ", string.Empty); var index = cs.IndexOf(s) + s.Length; var length = cs.IndexOf(';', index) - index; return (length > 0) ? cs.Substring(index, length) : cs.Substring(index); }
private static RepositoryType GetRepoType(string connectionName) { ConnectionStringElement configElement = Configuration.Current.Databases[connectionName]; return(configElement != null ? configElement.DbType : Configuration.Current.Repository.DefaultRepoType); }