public void AddNewAttribute(string attributeName, string newSimpleDataType, uint?lower, UnlimitedNatural?upper, string @default) { MacroCommand <ModelController> command = MacroCommandFactory <ModelController> .Factory().Create(DiagramController.ModelController); AddSimpleTypeCommand simpleTypeCommand = (AddSimpleTypeCommand)AddSimpleTypeCommandFactory.Factory().Create(DiagramController.ModelController); ElementHolder <DataType> type = new ElementHolder <DataType>(); simpleTypeCommand.CreatedSimpleType = type; command.Commands.Add(simpleTypeCommand); NewAttributeCommand attributeCommand = (NewAttributeCommand)NewAttributeCommandFactory.Factory().Create(DiagramController.ModelController); if (!String.IsNullOrEmpty(attributeName)) { attributeCommand.Name = attributeName; } else { attributeCommand.Name = NameSuggestor <Property> .SuggestUniqueName(Class.Attributes, "Attribute", property => property.Name); } attributeCommand.Type = type; attributeCommand.Lower = lower; attributeCommand.Upper = upper; attributeCommand.Default = @default; attributeCommand.Owner = Class; command.Commands.Add(attributeCommand); command.Execute(); }
public void CreateSimpleType(string name, Package package, SimpleDataType parent, string xsdImplementation, ElementHolder <DataType> holder) { AddSimpleTypeCommand simpleTypeCommand = (AddSimpleTypeCommand)AddSimpleTypeCommandFactory.Factory().Create(this); simpleTypeCommand.XSDefinition = xsdImplementation; simpleTypeCommand.CreatedSimpleType = holder; simpleTypeCommand.TypeName = name; simpleTypeCommand.Parent = parent; simpleTypeCommand.Package = package; simpleTypeCommand.Execute(); }