Exemple #1
0
 public static void StartNestedTransaction(this Document doc, String command, Action <NestableAcTransaction, BlockTableRecord> action)
 {
     command = command ?? DEFAULTCOMMAND;
     doc.TransactionManager.EnableGraphicsFlush(true);
     try
     {
         using (NestableAcTransaction tr = new NestableAcTransaction(doc))
         {
             var modelspace = tr.ModelSpace;
             using (new WriteEnabler(doc, modelspace))
             {
                 if (modelspace.IsWriteEnabled)
                 {
                     action(tr, modelspace);
                 }
                 else
                 {
                     throw new WriteEnablerException("Couldn't WriteEnable modelspace.");
                 }
             }
         }
     }
     catch (WriteEnablerException weEx)
     {
         throw new AcTransactionException("Couldn't start a nested transaction.", weEx);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
 public static void StartNestedTransaction(this Document doc, string command, Action <NestableAcTransaction> action)
 {
     command = command ?? DEFAULTCOMMAND;
     using (NestableAcTransaction tr = new NestableAcTransaction(doc))
     {
         action(tr);
     }
 }