/// <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); }
/// <summary> /// Begin a Root Transaction on Server & /// Begin a nested Transaction for use on Collections. /// </summary> /// <param name="server"></param> /// <returns></returns> public static ITransactionLogger BeginWithNewRoot(Sop.ObjectServerWithTransaction server) { TransactionRoot root = TransactionRoot.BeginRoot(server.Path); return(Begin(root, server, true)); }