예제 #1
0
파일: Workspace.cs 프로젝트: zrolfs/pwiz
 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);
 }
예제 #2
0
파일: Workspace.cs 프로젝트: zrolfs/pwiz
 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);
 }
예제 #3
0
 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;
 }
예제 #4
0
파일: Workspace.cs 프로젝트: zrolfs/pwiz
 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);
     }
 }
예제 #5
0
 public WorkspaceUpgrader(TpgLinkDef tpgLinkDef)
 {
     TpgLinkDef = tpgLinkDef;
 }