/// <summary> /// Begin transaction and open the ObjectServer in the specified path/filename /// </summary> /// <param name="serverFilename"></param> /// <param name="serverProfile"></param> /// <returns></returns> public static ObjectServerWithTransaction BeginOpenServer(string serverFilename, Preferences preferences) { ObjectServerWithTransaction r = RollbackAll(serverFilename, preferences, false); if (r != null) { if (r.Transaction == null) { string serverRootPath = Path.GetDirectoryName(serverFilename); if (string.IsNullOrEmpty(serverRootPath)) { serverRootPath = System.Environment.CurrentDirectory; } TransactionRoot root = TransactionRoot.BeginRoot(serverRootPath); root.Server = r; r.Transaction = root; root.Begin(true); } } else { string serverRootPath = Path.GetDirectoryName(serverFilename); if (string.IsNullOrEmpty(serverRootPath)) { serverRootPath = System.Environment.CurrentDirectory; } TransactionRoot root = TransactionRoot.BeginRoot(serverRootPath); root.IsDisposing = true; r = new Sop.ObjectServerWithTransaction(serverFilename, root, preferences); ITransactionLogger trans = root.Begin(true); trans.IsDisposing = true; } return(r); }
public static ITransactionLogger Begin(TransactionRoot rootTrans, Sop.ObjectServerWithTransaction server, bool ownsRoot) { rootTrans.Server = server; server.Transaction = rootTrans; var t = (TransactionBase)rootTrans.Begin(ownsRoot); return(t); }