public override void ElementAdded(ElementAddedEventArgs e) { PrimitiveDataTypeCollection dataContractPrimitiveCollection = e.ModelElement as PrimitiveDataTypeCollection; if (dataContractPrimitiveCollection == null) { return; } DataContractModel root = dataContractPrimitiveCollection.DataContractModel; if (root != null && root.ImplementationTechnology != null) { ExtensionProviderHelper.AttachObjectExtender(dataContractPrimitiveCollection, root.ImplementationTechnology); } if (string.IsNullOrEmpty(dataContractPrimitiveCollection.ItemType)) { dataContractPrimitiveCollection.ItemType = typeof(string).FullName; } if (String.IsNullOrEmpty(dataContractPrimitiveCollection.Namespace)) { dataContractPrimitiveCollection.Namespace = ArtifactLinkHelper.DefaultNamespace(e.ModelElement); } UpdateDataContractCollectionType(dataContractPrimitiveCollection, CollectionTypes.Values[CollectionTypes.ListKey]); }
private PrimitiveDataTypeCollection CreateDefaultPrimitiveDataTypeCollection(Type collectionType, string itemType) { PrimitiveDataTypeCollection rootElement = new PrimitiveDataTypeCollection(Store); rootElement.DataContractModel = new DataContractModel(Store); rootElement.DataContractModel.ProjectMappingTable = "WCF"; rootElement.Name = ElementName; rootElement.Namespace = ElementNamespace; rootElement.ObjectExtender = AttachDataContractCollectionExtender(rootElement, collectionType); rootElement.ItemType = itemType; return rootElement; }