public override void ExecCommand(MenuCommand menuCommand) { var currentSelection = GetCurrentSelectedPersistentType(); PersistentType currentPersistentType = currentSelection.CurrentPersistentType; PropertyBase newProperty = null; currentSelection.MakeActionWithinTransaction(string.Format("Add scalar property into '{0}'", currentPersistentType.Name), () => { newProperty = CreateNewProperty(currentPersistentType, GetPropertyKind()); }); if (newProperty != null) { Owner.SelectModelElement((ModelElement)currentPersistentType); var propertyBase = newProperty as IPropertyBase; var persistentType = propertyBase.GetRealOwner(); string compartmentName = propertyBase.PropertyKind == PropertyKind.Navigation ? "NavigationProperties" : "Properties"; DiagramUtil.SelectCompartmentItem(currentSelection.DiagramDocView, (ModelElement)persistentType, compartmentName, newProperty); } }
public override void ExecCommand(MenuCommand menuCommand) { var currentSelection = GetCurrentSelectedPersistentType(); PersistentType currentPersistentType = currentSelection.CurrentPersistentType; EntityIndex newIndex = null; currentSelection.MakeActionWithinTransaction( string.Format("Add entity index into '{0}'", currentPersistentType.Name), () => { Interface ownerInterface = (Interface)currentPersistentType; newIndex = new EntityIndex(currentPersistentType.Partition); ownerInterface.Indexes.Add(newIndex); newIndex.Name = string.Format("Index{0}", ownerInterface.Indexes.Count); }); if (newIndex != null) { DiagramUtil.SelectCompartmentItem(currentSelection.DiagramDocView, currentPersistentType, "Indexes", newIndex); } }