public DBSessionSettings(DBSessionSettings anotherSettings) { //general settings foreach (var aSetting in anotherSettings._SessionSettings) { _SessionSettings.Add(aSetting.Key, aSetting.Value.Clone()); } //db settings foreach (var aSetting in anotherSettings._SessionSettingsDB) { _SessionSettingsDB.Add(aSetting.Key, (ADBSettingsBase)aSetting.Value.Clone()); } //session settings foreach (var aSetting in anotherSettings._SessionSettingsSession) { if (_SessionSettingsDB.ContainsKey(aSetting.Key)) { _SessionSettingsDB[aSetting.Key] = (ADBSettingsBase)aSetting.Value.Clone(); } else { _SessionSettingsDB.Add(aSetting.Key, (ADBSettingsBase)aSetting.Value.Clone()); } } //type settings foreach (var aType in anotherSettings._SessionSettingsType) { _SessionSettingsType.Add(aType.Key, new Dictionary<string, ADBSettingsBase>()); foreach (var aSetting in aType.Value) { _SessionSettingsType[aType.Key].Add(aSetting.Key, (ADBSettingsBase)aSetting.Value.Clone()); } } //attribute settings foreach (var aType in anotherSettings._SessionSettingsTypeAttribute) { _SessionSettingsTypeAttribute.Add(aType.Key, new Dictionary<AttributeUUID, Dictionary<string, ADBSettingsBase>>()); foreach (var aAttribute in aType.Value) { _SessionSettingsTypeAttribute[aType.Key].Add(aAttribute.Key, new Dictionary<string, ADBSettingsBase>()); foreach (var aSetting in aAttribute.Value) { _SessionSettingsTypeAttribute[aType.Key][aAttribute.Key].Add(aSetting.Key, (ADBSettingsBase)aSetting.Value.Clone()); } } } }
/// <summary> /// This will create a new dbContext, based on <paramref name="dbContext"/> reusing all shared data /// </summary> /// <param name="dbContext"></param> public DBContext(DBContext dbContext) { #region Immutable objects _DBPluginManager = dbContext.DBPluginManager; _DBSettingsManager = dbContext.DBSettingsManager; _IGraphFSSession = dbContext._IGraphFSSession; #endregion _SessionSettings = new DBSessionSettings(dbContext.SessionSettings); _DBObjectManager = new ObjectManagement.DBObjectManager(this, _IGraphFSSession); // _DBIndexManager = new Indices.DBIndexManager(_IGraphFSSession, this); _DBTypeManager = new DBTypeManager(dbContext.DBTypeManager); _DBObjectCache = _DBObjectManager.GetSimpleDBObjectCache(this); }
/// <summary> /// The constructor. /// </summary> /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param> /// <param name="DatabaseRootPath">The database root path.</param> public DBContext(IGraphFSSession graphFSSession, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, Boolean myRebuildIndices, DBPluginManager myDBPluginManager, DBSessionSettings sessionSettings = null) { _DBPluginManager = myDBPluginManager; _DBTypeManager = new TypeManagement.DBTypeManager(graphFSSession, myDatabaseRootPath, myUserID, myDBSettings, this); _DBSettingsManager = new DBSettingsManager(_DBPluginManager.Settings, myDBSettings, graphFSSession, new ObjectLocation(myDatabaseRootPath.Name, DBConstants.DBSettingsLocation)); _DBObjectManager = new DBObjectManager(this, graphFSSession); _DBIndexManager = new DBIndexManager(graphFSSession, this); _SessionSettings = sessionSettings; _DBObjectCache = _DBObjectManager.GetSimpleDBObjectCache(this); _IGraphFSSession = graphFSSession; //init types var initExcept = _DBTypeManager.Init(graphFSSession, myDatabaseRootPath, myRebuildIndices); if (initExcept.Failed()) { throw new GraphDBException(initExcept.IErrors); } }