private void RemoveNodesByType(DocumentCompositeNode compositeNode, SampleNonBasicType deletedType) { if (compositeNode == null) { return; } List <IProperty> list = new List <IProperty>((IEnumerable <IProperty>)compositeNode.Properties.Keys); for (int index = 0; index < list.Count; ++index) { IProperty property = list[index]; DocumentNode documentNode = compositeNode.Properties[(IPropertyId)property]; if (documentNode.Type == deletedType) { compositeNode.ClearValue((IPropertyId)property); ++this.changeCount; } else { this.RemoveNodesByType(documentNode as DocumentCompositeNode, deletedType); } } if (!compositeNode.SupportsChildren) { return; } for (int index = 0; index < compositeNode.Children.Count; ++index) { this.RemoveNodesByType(compositeNode.Children[index] as DocumentCompositeNode, deletedType); } }
private XmlSchemaType GetOrCreateSchemaType(SampleNonBasicType sampleType) { XmlSchemaType xmlSchemaType = (XmlSchemaType)null; if (!this.schemaTypes.TryGetValue(sampleType.Name, out xmlSchemaType)) { xmlSchemaType = !sampleType.IsCollection ? this.CreateSchemaCompositeType(sampleType as SampleCompositeType) : this.CreateSchemaCollectionType(sampleType as SampleCollectionType); } return(xmlSchemaType); }
private void ResetDesignTimeType(SampleNonBasicType sampleType) { if (sampleType == null) { return; } sampleType.DesignTimeType = (Type)null; SampleCompositeType sampleCompositeType = sampleType as SampleCompositeType; if (sampleCompositeType == null) { return; } foreach (SampleProperty sampleProperty in (IEnumerable <SampleProperty>)sampleCompositeType.SampleProperties) { sampleProperty.ResetPropertyInfo(); } }
public IType GetSampleType(Type type) { if (this.dataSets.Count == 0) { return((IType)null); } SampleNonBasicType sampleType = SampleDataSet.SampleDataTypeFromType(type); if (sampleType == null) { return((IType)null); } if (this.dataSets.Find((Predicate <SampleDataSet>)(s => s == sampleType.DeclaringDataSet)) == null) { return((IType)null); } return((IType)sampleType); }
private Type GetOrBeginDesignTimeType(SampleType sampleType) { Type type; if (!sampleType.IsBasicType) { SampleNonBasicType key = (SampleNonBasicType)sampleType; SampleDataDesignTimeTypeGenerator.TypeBuildState typeBuildState = (SampleDataDesignTimeTypeGenerator.TypeBuildState)null; if (!this.buildStates.TryGetValue(key, out typeBuildState)) { typeBuildState = !sampleType.IsCollection ? this.BeginCompositeType((SampleCompositeType)sampleType) : this.BeginCollectionType((SampleCollectionType)sampleType); this.buildStates[key] = typeBuildState; } type = typeBuildState.TypeBuilder.UnderlyingSystemType; } else { type = this.dataSet.ResolveSampleType(sampleType).RuntimeType; } return(type); }
private Type GetOrGenerateDesignTimeType(SampleType sampleType) { Type type; if (!sampleType.IsBasicType) { SampleNonBasicType index = (SampleNonBasicType)sampleType; SampleDataDesignTimeTypeGenerator.TypeBuildState buildState = this.buildStates[index]; if (!buildState.IsGenerated) { buildState.IsGenerated = true; index.DesignTimeType = !sampleType.IsCollection ? this.GenerateCompositeType((SampleCompositeType)sampleType, buildState) : this.GenerateCollectionType((SampleCollectionType)sampleType, buildState); } type = index.DesignTimeType; } else { type = this.dataSet.ResolveSampleType(sampleType).RuntimeType; } return(type); }
private DocumentNode GenerateNonBasicValue(SampleNonBasicType sampleType) { DocumentCompositeNode compositeNode = this.CreateCompositeNode(sampleType); if (sampleType.IsCollection) { SampleCollectionType sampleCollectionType = (SampleCollectionType)sampleType; if (this.buildingStack.PushCollectionItemType((SampleType)sampleCollectionType)) { int collectionCount = this.CollectionCount; ++this.collectionDepth; for (int index = 0; index < collectionCount; ++index) { DocumentNode documentNode = this.GenerateValue(sampleCollectionType.ItemSampleType); compositeNode.Children.Add(documentNode); } --this.collectionDepth; this.buildingStack.Pop(); } } else { foreach (SampleProperty sampleProperty in (IEnumerable <SampleProperty>)((SampleCompositeType)sampleType).SampleProperties) { if (this.buildingStack.PushProperty(sampleProperty)) { DocumentNode documentNode = this.GeneratePropertyValue(sampleProperty); if (documentNode != null) { compositeNode.Properties[(IPropertyId)sampleProperty] = documentNode; } this.buildingStack.Pop(); } } } return((DocumentNode)compositeNode); }
public SampleProperty AddProperty(SampleNonBasicType sampleType) { return(this.AddProperty(sampleType.Name, (SampleType)sampleType)); }
public override DocumentCompositeNode CreateCompositeNode(SampleNonBasicType sampleType) { return(sampleType != this.DataSet.RootType ? base.CreateCompositeNode(sampleType) : this.RootNode); }
public virtual DocumentCompositeNode CreateCompositeNode(SampleNonBasicType sampleType) { return(this.XamlDocumentContext.CreateNode((ITypeId)sampleType)); }