Deveel.Data.Database.Open C# (CSharp) Method

Open() private method

Opens the database making it ready to be accessed.

This method ensures the system components and the data are ready to allow any connection to be established.

After this method successfully exists, the state of IsOpen is changed to true.

/// The database was already initialized. /// or /// or /// An error occurred when initializing the database. ///
private Open ( ) : void
return void
        internal void Open()
        {
            if (IsOpen)
                throw new DatabaseSystemException("The database was already initialized.");

            try {
                // Check if the state file exists.  If it doesn't, we need to report
                // incorrect version.
                if (!TableComposite.Exists())

                    // If neither store or state file exist, assume database doesn't
                    // exist.
                    throw new DatabaseSystemException(String.Format("The database {0} does not exist.", Name));

                // Open the conglomerate
                TableComposite.Open();

                AssertDataVersion();
            } catch (DatabaseSystemException) {
                throw;
            } catch (Exception e) {
                throw new DatabaseSystemException("An error occurred when initializing the database.", e);
            }

            IsOpen = true;
        }

Usage Example

Ejemplo n.º 1
0
        protected virtual IDatabase CreateDatabase(IDatabaseContext context)
        {
            var database = new Database(context);
            database.Create(AdminUserName, AdminPassword);
            database.Open();

            return database;
        }
All Usage Examples Of Deveel.Data.Database::Open