示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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;
        }
示例#4
0
        /// <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;
        }