Transactions shared between modules
I noticed that all managers have a TransactionName proproperty
switch (e.CommandName)
case "DeleteProject":
var projectName = e.CommandArgument.ToString();
var dynamicModuleManager = DynamicModuleManager.GetManager();
dynamicModuleManager.TransactionName = "RemoveProject";
var project = GetMyProjects(dynamicModuleManager).FirstOrDefault(p => p.GetValue<
String
>("Title") == projectName);
if (project != null)
var ownerId = project.Owner;
if (ownerId != SecurityManager.GetCurrentUserId())
throw new Exception("Incorrect permissions for project deletion.");
var manager = LibrariesManager.GetManager();
manager.TransactionName = "RemoveProject";
var album = GetProjectAlbum(manager, project);
manager.DeleteAlbum(album);
dynamicModuleManager.DeleteItem(project);
TransactionManager.CommitTransaction("RemoveProject");
break;