public virtual void SetUp() { base.SetUp(); #region initialize Context services.AddSingleton <IDatabase, Database>(); Context.Initialize(services); Context.Current.Set(services.BuildServiceProvider()); database = Context.Current.GetService <IDatabase>(); database.Configure(); #endregion #region Init Database files TempDatabaseName = DatabaseServer.GetDatabaseName(); var createScript = GetCreateDbFiles().Select(f => File.ReadAllText(f.FullName)).ToLinesString(); var hash = createScript.ToSimplifiedSHA1Hash().Replace("/", "-").Replace("\\", "-"); DatabaseFilesPath = DatabaseStoragePath.GetOrCreateSubDirectory(TempDatabaseName).GetOrCreateSubDirectory(hash); #endregion }
private void CreateNewConnectionString() { MySqlConnectionStringBuilder mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder { Server = _server.GetHost(), Port = _server.GetPort(), UserID = _server.GetUserName(), Password = _server.GetPassword(), Database = _server.GetDatabaseName(), MinimumPoolSize = _beginClientAmount, MaximumPoolSize = _maxPoolSize, Pooling = true, AllowZeroDateTime = true, ConvertZeroDateTime = true, DefaultCommandTimeout = 300, ConnectionTimeout = 10 }; MySqlConnectionStringBuilder mySqlConnectionStringBuilder2 = mySqlConnectionStringBuilder; SetConnectionString(mySqlConnectionStringBuilder2.ToString()); }