示例#1
0
文件: Workspace.cs 项目: zrolfs/pwiz
 private void CloseSessionFactory()
 {
     if (!ReferenceEquals(this, _owner))
     {
         return;
     }
     if (SessionFactory != null)
     {
         using (var session = SessionFactory.OpenSession())
         {
             session.BeginTransaction();
             var criteria = session.CreateCriteria(typeof(DbLock))
                            .Add(Restrictions.Eq("InstanceIdBytes", InstanceId.ToByteArray()));
             foreach (DbLock dbLock in criteria.List())
             {
                 session.Delete(dbLock);
             }
             session.Transaction.Commit();
         }
         SessionFactory.Close();
         _sessionFactory = null;
     }
 }