Beispiel #1
0
        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());
        }
Beispiel #2
0
 public IManage.IManDatabase DB(DbNameType dbNameType)
 {
     return(Session().Databases.ItemByName(dbNameType.ToString()));
 }
Beispiel #3
0
 public IManage.IManDatabase DB(DbNameType dbNameType)
 {
     return Session().Databases.ItemByName(dbNameType.ToString());
 }