Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

TransactionGroup Rollback

Anonymous

TransactionGroup Rollback

Anonymous
Not applicable

Hi all. Maybe someone across this problem. 
I do rollback transactionGroup after commiting some transactions in this group. But it isn't works in local file which was done from central model. It successfully works in usual local file. Can anyone help me?

 using (TransactionGroup transactionGroup = new TransactionGroup(Doc, "TransGroup"))
                {
                    transactionGroup.Start("Numerating Sheets");
                    Transaction transaction = new Transaction(Doc, "Transaction");
                    foreach (var sheet in sheets)
                    {
                        if (_flag)
                        {
                            transactionGroup.RollBack();
                            break;
                        }
                        transaction.Start("Numbering Sheet");
                        ViewSheet viewSheet = Doc.GetElement(sheet.ElementId) as ViewSheet;
                        viewSheet.SheetNumber = sheet.Number;
                        MainWindow.ProgressBar.Dispatcher.Invoke(new ProgressBarDelegate(UpdateProgress),
                            DispatcherPriority.Background);
                        transaction.Commit();
                    }
                    if (!_flag)
                        transactionGroup.Assimilate();
0 Likes
Reply
Accepted solutions (1)
617 Views
4 Replies
Replies (4)

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

These links will help you to solve your issue

https://thebuildingcoder.typepad.com/blog/2013/12/saving-a-new-central-file-to-revit-server.html 

https://thebuildingcoder.typepad.com/blog/2013/12/saving-a-new-central-file-to-revit-server.html#4 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes

Anonymous
Not applicable

Thank you for reporting, but in that article Jeremy said about naming of transactions. In my case, i just can't rollback group of transactions. TransactionStatus is RolledBack, but changes still accepted.

0 Likes

jeremytammik
Autodesk
Autodesk
Accepted solution

All you are doing in each individual transaction is renumbering a sheet.

 

Why waste an entire transaction for that task?

 

Why not do all the renumbering of all sheets in one single transaction?

 

What possible causes can you have to want to roll back the modification?

 

From this minimal snippet of your, it looks to me as if you could simplify your process.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Anonymous
Not applicable

Thank you for answer! I did renumbering in single transaction as you say. My sollution was really hard 🙂
I want to user can abort numbering and don't wait for ending of operation. 

0 Likes