/// <summary> /// DBriize instantiator /// </summary> /// <param name="DBriizeConfiguration"></param> public DBriizeEngine(DBriizeConfiguration DBriizeConfiguration) { ConstructFromConfiguration(DBriizeConfiguration); //if (Configuration != null) // Configuration = DBriizeConfiguration; ////Setting up in backup DBriizeFolderName, there must be found at least TransJournal and Scheme. ////Configuration.Backup.SynchronizeBackup has more information //if (Configuration.Backup.IsActive) //{ // Configuration.Backup.DBriizeFolderName = Configuration.DBriizeDataFolderName; // ////Running backup synchronization // //Configuration.Backup.SynchronizeBackup(); //} //MainFolder = Configuration.DBriizeDataFolderName; //InitDb(); ////Console.WriteLine("DBriize notification: Don't forget in the dispose function of your DLL or main application thread"); ////Console.WriteLine(" to dispose DBriize engine: if(_engine != null) _engine.Dispose(); "); ////Console.WriteLine(" to get graceful finilization of all working threads! "); }
/// <summary> /// Constructing DBriize from DBriizeConfiguration /// </summary> /// <param name="DBriizeConfiguration"></param> internal void ConstructFromConfiguration(DBriizeConfiguration DBriizeConfiguration) { if (Configuration != null) { Configuration = DBriizeConfiguration; } else { throw new Exception("DBriize.DBriizeEngine.DBriizeEngine: please supply DBriizeConfiguration"); } //Setting up in backup DBriizeFolderName, there must be found at least TransJournal and Scheme. //Configuration.Backup.SynchronizeBackup has more information if (Configuration.Backup.IsActive) { Configuration.Backup.DBriizeFolderName = Configuration.DBriizeDataFolderName; ////Running backup synchronization //Configuration.Backup.SynchronizeBackup(); } if (DBriizeConfiguration.Storage == DBriizeConfiguration.eStorage.RemoteInstance && !RemoteEngine) { throw new Exception("DBriize.DBriizeEngine.DBriizeEngine: remote instance must be initiated via new DBriizeRemoteEngine"); } MainFolder = Configuration.DBriizeDataFolderName; InitDb(); //Console.WriteLine("DBriize notification: Don't forget in the dispose function of your DLL or main application thread"); //Console.WriteLine(" to dispose DBriize engine: if(_engine != null) _engine.Dispose(); "); //Console.WriteLine(" to get graceful finilization of all working threads! "); }
/// <summary> /// DBriizeRemoteEngine instantiator /// </summary> /// <param name="DBriizeConfiguration"></param> public DBriizeRemoteEngine(DBriizeConfiguration DBriizeConfiguration) { if (DBriizeConfiguration == null) { throw new Exception("DBriize.DBriizeRemoteEngine.DBriizeRemoteEngine: DBriizeConfiguration is NULL"); } conf = DBriizeConfiguration; this.RemoteEngine = true; }