/// <inheritdoc/> public IDatabaseInterface Boot(IDbConfig config) { if (booted) { throw new DataException("Database was booted more than once."); } // Local connections are formatted as; // 'Local/[type]/[connect_id]' string hostString = String.Format("{0}/Boot/", KnownConnectionProtocols.Local); // Start the DbSystem and bind it to a IDatabaseInterface. if (controller.IsInitialized(databaseName)) { dbsys = controller.ConnectToDatabase(config, databaseName); } else { dbsys = controller.StartDatabase(config, databaseName); } IDatabaseInterface dbInterface = new LocalDatabaseInterface(this, hostString); booted = true; ++openConnections; return(dbInterface); }
/// <inheritdoc/> public IDatabaseInterface Create(string username, string password, IDbConfig config) { if (String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password)) { throw new DataException("Username and Password must both be set."); } if (booted) { throw new DataException("Database is already created."); } // Local connections are formatted as; // 'Local/[type]/[connect_id]' string hostString = String.Format("{0}/Create/", KnownConnectionProtocols.Local); // Create the DbSystem and bind it to a IDatabaseInterface. dbsys = controller.CreateDatabase(config, databaseName, username, password); IDatabaseInterface dbInterface = new LocalDatabaseInterface(this, hostString); booted = true; ++openConnections; return(dbInterface); }
/// <inheritdoc/> public IDatabaseInterface Connect() { if (!booted) { throw new DataException("The database is not started."); } // Local connections are formatted as; // 'Local/[type]/[connect_id]' string hostString = String.Format("{0}/Connection/{1}", KnownConnectionProtocols.Local, connectId); // Create a IDatabaseInterface, IDatabaseInterface dbInterface = new LocalDatabaseInterface(this, hostString); ++connectId; ++openConnections; return(dbInterface); }
/// <inheritdoc/> public IDatabaseInterface Boot(IDbConfig config) { if (booted) throw new DataException("Database was booted more than once."); // Local connections are formatted as; // 'Local/[type]/[connect_id]' string hostString = String.Format("{0}/Boot/", KnownConnectionProtocols.Local); // Start the DbSystem and bind it to a IDatabaseInterface. if (controller.IsInitialized(databaseName)) dbsys = controller.ConnectToDatabase(config, databaseName); else dbsys = controller.StartDatabase(config, databaseName); IDatabaseInterface dbInterface = new LocalDatabaseInterface(this, hostString); booted = true; ++openConnections; return dbInterface; }
/// <inheritdoc/> public IDatabaseInterface Create(string username, string password, IDbConfig config) { if (String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password)) throw new DataException("Username and Password must both be set."); if (booted) throw new DataException("Database is already created."); // Local connections are formatted as; // 'Local/[type]/[connect_id]' string hostString = String.Format("{0}/Create/", KnownConnectionProtocols.Local); // Create the DbSystem and bind it to a IDatabaseInterface. dbsys = controller.CreateDatabase(config, databaseName, username, password); IDatabaseInterface dbInterface = new LocalDatabaseInterface(this, hostString); booted = true; ++openConnections; return dbInterface; }
/// <inheritdoc/> public IDatabaseInterface Connect() { if (!booted) throw new DataException("The database is not started."); // Local connections are formatted as; // 'Local/[type]/[connect_id]' string hostString = String.Format("{0}/Connection/{1}", KnownConnectionProtocols.Local, connectId); // Create a IDatabaseInterface, IDatabaseInterface dbInterface = new LocalDatabaseInterface(this, hostString); ++connectId; ++openConnections; return dbInterface; }