コード例 #1
0
        public void Setup()
        {
            var databaseManager = new DisposableDbManager(DbCreationPath, ConnectionString, CatalogName);
            _disposableDbName = databaseManager.CreateCompleteDisposableDb();

            var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConnectionString)
                                             	{
                                             		InitialCatalog = _disposableDbName
                                             	};
            _connectionStringWithDbName = sqlConnectionStringBuilder.ToString();
        }
コード例 #2
0
        private string CreateDisposableDb(string databaseName)
        {
            var restOfConnString = ConfigurationManager.AppSettings["DisposableDbConnString"] + ";Application Name=" + ApplicationNameForConnectionString + ";";
            var dbhostname = ConfigurationManager.AppSettings["DisposableDbHostname"];
            var dbCreationPath = ConfigurationManager.AppSettings["DbCreationPath"];

            var server = ConnectionHelper.Connect(dbhostname, restOfConnString);

            var disposableDbManager = new DisposableDbManager(dbCreationPath, server, databaseName);
            var disposableDbName = disposableDbManager.CreateCompleteDisposableDb();

            return string.Format("Initial Catalog={0};Data Source={1};{2}", disposableDbName, dbhostname, restOfConnString);
        }
コード例 #3
0
 public void CreateDisposableDb()
 {
     string dbCreationPath = ConfigurationManager.AppSettings["DbCreationPath"];
     Server server = DatabaseCreationTests.GetDisposableDbServer();
     var creator = new DisposableDbManager(dbCreationPath, server, DbName);
     DisposableDb = server.Databases[creator.CreateCompleteDisposableDb()];
 }