/// <summary> /// Deletes all Package Dependencies from the Repository /// </summary> /// <param name="repository"></param> /// <param name="package"></param> /// <exception cref="NotImplementedException"></exception> public static void DeleteDependenciesFromModel(Repository repository, Package package) { List <Package> allPackages = Manipulation.GetAllPackages(repository); List <Connector> allPackageConnectors = new List <Connector>(); foreach (var thePackage in allPackages) { allPackageConnectors.AddRange(Manipulation.GetAllPackageConnectors(thePackage)); } IEnumerable <Connector> affectedConnectors = allPackageConnectors.Where(con => con.Stereotype.Equals(appSettings.Stereotype)); foreach (Connector packageConnector in affectedConnectors) { repository.Execute("DELETE FROM t_connector WHERE Connector_ID =" + packageConnector.ConnectorID + ";"); repository.Execute("DELETE FROM t_diagramlinks WHERE ConnectorID =" + packageConnector.ConnectorID + ";"); } List <Diagram> allDiagrams = Manipulation.GetAllDiagrams(package); foreach (Diagram theDiagram in allDiagrams) { if (theDiagram.Stereotype == "generated") { theDiagram.Update(); foreach (DiagramObject diagramObj in theDiagram.DiagramObjects) { diagramObj.Update(); } theDiagram.Update(); //If diagram open than close and open if (repository.IsTabOpen(theDiagram.Name) != 0) { repository.CloseDiagram(theDiagram.DiagramID); repository.OpenDiagram(theDiagram.DiagramID); } } } }