public static string Get(string dataSource , DbNameType dbNameType = DbNameType.Active, bool integratedSecurity = true, string userID = null, string password = null) { string providerName = "System.Data.SqlClient"; SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(); sqlBuilder.DataSource = dataSource; sqlBuilder.InitialCatalog = dbNameType.ToString(); sqlBuilder.IntegratedSecurity = integratedSecurity; if (!sqlBuilder.IntegratedSecurity) { sqlBuilder.UserID = userID; sqlBuilder.Password = password; } string providerString = sqlBuilder.ToString(); EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder(); entityBuilder.Provider = providerName; entityBuilder.ProviderConnectionString = providerString; return(sqlBuilder.ToString()); }
public IManage.IManDatabase DB(DbNameType dbNameType) { return(Session().Databases.ItemByName(dbNameType.ToString())); }
public IManage.IManDatabase DB(DbNameType dbNameType) { return Session().Databases.ItemByName(dbNameType.ToString()); }