public ScalarProperty AddScalarProperty(string name, DomainType type) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (this.GetScalarProperties().Any(item => Util.StringEqual(item.Name, name, true))) { throw new ApplicationException(string.Format("Scalar property with name '{0}' already exist.", name)); } ScalarProperty newProperty = new ScalarProperty(this.Partition); newProperty.Type = type;//SystemPrimitiveTypesConverter.GetDisplayName(type); this.Properties.Add(newProperty); return(newProperty); }
public override void ExecCommand(MenuCommand menuCommand) { EntityModel entityModel = Owner.GetEntityModel(); DomainType externalType = null; entityModel.Store.MakeActionWithinTransaction("Add new external type...", delegate { string[] existingExternalTypeNames = entityModel.DomainTypes.Where(item => item.Namespace == "System").Select(item => item.Name).ToArray(); externalType = new DomainType(entityModel.Partition); entityModel.DomainTypes.Add(externalType); externalType.Name = Util.GenerateUniqueName(existingExternalTypeNames, "Name"); externalType.Namespace = "System"; }); if (externalType != null) { Owner.SelectTreeNodeByText(externalType.FullName); } }