public Workspace(Workspace workspace) : this() { _owner = workspace._owner; InstanceId = workspace.InstanceId; DatabasePath = workspace.DatabasePath; DatabaseLock = workspace.DatabaseLock; _tpgLinkDef = workspace.TpgLinkDef; _data = workspace._data; _savedWorkspaceData = workspace._savedWorkspaceData; RetentionTimeAlignments = new RetentionTimeAlignments(Data); RetentionTimeAlignments.MergeFrom(workspace.RetentionTimeAlignments); }
public void SetDataDirectory(string directory) { if (directory == GetDataDirectory()) { return; } ClearRejectedMsDataFiles(); if (TpgLinkDef != null) { TpgLinkDef.DataDirectory = directory; TpgLinkDef.Save(DatabasePath); return; } Settings.SetSetting(SettingEnum.data_directory, directory); }
public static ISessionFactory CreateSessionFactory(TpgLinkDef tpgLinkDef, SessionFactoryFlags flags) { var configuration = GetConfiguration(tpgLinkDef.DatabaseTypeEnum, flags) .SetProperty("connection.connection_string", tpgLinkDef.GetConnectionString()); var sessionFactory = configuration.BuildSessionFactory(); if (0 != (flags & SessionFactoryFlags.CreateSchema)) { using (var session = sessionFactory.OpenSession()) { var schemaExport = new SchemaExport(configuration); if (DatabaseTypeEnum.mysql == tpgLinkDef.DatabaseTypeEnum) { session.CreateSQLQuery("SET storage_engine = 'InnoDB'").ExecuteUpdate(); } schemaExport.Execute(false, true, false, session.Connection, null); } } return sessionFactory; }
private void OpenSessionFactory() { if (!ReferenceEquals(this, _owner)) { return; } if (SessionFactory != null) { throw new InvalidOperationException("SessionFactory is already open"); } if (Path.GetExtension(DatabasePath) == TpgLinkDef.Extension) { _tpgLinkDef = TpgLinkDef.Load(DatabasePath); _sessionFactory = SessionFactoryFactory.CreateSessionFactory(TpgLinkDef, 0); } else { _sessionFactory = SessionFactoryFactory.CreateSessionFactory(DatabasePath, 0); } }
public WorkspaceUpgrader(TpgLinkDef tpgLinkDef) { TpgLinkDef = tpgLinkDef; }