Esempio n. 1
0
        public IServerConnector Boot(IDbConfig config)
        {
            if (IsBooted)
                throw new DatabaseException("Database was booted more than once.");

            // Start the DbSystem and bind it to a IDatabaseInterface.
            if (System.Controller.IsInitialized(databaseName))
                dbsys = System.Controller.ConnectToDatabase(config, databaseName);
            else
                dbsys = System.Controller.StartDatabase(config, databaseName);

            var connector = new LocalEmbeddedServerConnector(this);

            IsBooted = true;
            ++openConnections;

            return connector;
        }
Esempio n. 2
0
        public IServerConnector Connect(IDbConfig config)
        {
            if (!IsBooted)
                throw new DatabaseException("The database is not started.");

            var connector = new LocalEmbeddedServerConnector(this);

            ++openConnections;

            return connector;
        }
Esempio n. 3
0
        public IServerConnector Create(IDbConfig config, string userName, string password)
        {
            if (String.IsNullOrEmpty(userName))
                throw new ArgumentNullException("userName");
            if (String.IsNullOrEmpty(password))
                throw new ArgumentNullException("password");

            if (IsBooted)
                throw new DatabaseException("The database was already booted.");

            // Create the DbSystem and bind it to a IDatabaseInterface.
            dbsys = System.Controller.CreateDatabase(config, databaseName, userName, password);
            var connector = new LocalEmbeddedServerConnector(this);

            IsBooted = true;
            ++openConnections;

            return connector;
        }