Ejemplo n.º 1
0
        /// <summary>
        /// InitDb
        /// </summary>
        private void InitDb()
        {
            //trying to check and create folder

            try
            {
                lock (lock_initDb)
                {
                    //Init type converter
                    DataTypes.DataTypesConvertor.InitDict();

                    if (Configuration.Storage == DBreezeConfiguration.eStorage.DISK)
                    {
                        DirectoryInfo di = new DirectoryInfo(MainFolder);

                        if (!di.Exists)
                        {
                            di.Create();
                        }
                    }

                    //trying to open schema file
                    DBreezeSchema = new Scheme(this);

                    //Initializing Transactions Coordinator
                    _transactionsCoordinator = new TransactionsCoordinator(this);

                    //Initializing transactions Journal, may be later move journal into transactionsCoordinator
                    //We must create journal after Schema, for getting path to rollback files
                    _transactionsJournal = new TransactionsJournal(this);

                    //Initializes transaction locker, who can help block tables of writing and reading threads
                    _transactionTablesLocker = new TransactionTablesLocker();

                    //Initializing
                    DeferredIndexer = new TextDeferredIndexer(this);

                    //Init DBreezeResources
                    Resources = new DBreezeResources(this);
                }
            }
            catch (Exception ex)
            {
                DBisOperable       = false;
                DBisOperableReason = "InitDb";
                throw DBreezeException.Throw(DBreezeException.eDBreezeExceptions.CREATE_DB_FOLDER_FAILED, ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// InitDb
        /// </summary>
        private void InitDb()
        {
            //trying to check and create folder

            try
            {

                if (Configuration.Storage == DBreezeConfiguration.eStorage.DISK)
                {
                    DirectoryInfo di = new DirectoryInfo(MainFolder);

                    if (!di.Exists)
                        di.Create();
                }

                //trying to open schema file
                DBreezeSchema = new Scheme(this);

                //Initializing Transactions Coordinator
                _transactionsCoordinator = new TransactionsCoordinator(this);

                //Initializing transactions Journal, may be later move journal into transactionsCoordinator
                //We must create journal after Schema, for getting path to rollback files
                _transactionsJournal = new TransactionsJournal(this);

                //Initializes transaction locker, who can help block tables of writing and reading threads
                _transactionTablesLocker = new TransactionTablesLocker();

                //Initializing
                DeferredIndexer = new TextDeferredIndexer(this);
            }
            catch (Exception ex)
            {
                DBisOperable = false;
                DBisOperableReason = "InitDb";
                throw DBreezeException.Throw(DBreezeException.eDBreezeExceptions.CREATE_DB_FOLDER_FAILED, ex);
            }
        }