src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/Serializer.cs
/// <summary>
/// Serialize all child model elements.
/// </summary>
/// <param name="serializationContext">Serialization context.</param>
/// <param name="element">EntityDesignerViewModel instance to be serialized.</param>
/// <param name="writer">XmlWriter to write serialized data to.</param>
Serialize all child model elements.
Serialize all child model elements .
private static void WriteChildElements(DslModeling::SerializationContext serializationContext, global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel element, global::System.Xml.XmlWriter writer)
		{
			global::System.Collections.ObjectModel.ReadOnlyCollection<EntityDesignerViewModelHasEntityTypes> allEntityDesignerViewModelHasEntityTypesInstances = EntityDesignerViewModelHasEntityTypes.GetLinksToEntityTypes(element);
			if (!serializationContext.Result.Failed && allEntityDesignerViewModelHasEntityTypesInstances.Count > 0)
			{
				writer.WriteStartElement("entityTypes");
				global::System.Type typeofEntityDesignerViewModelHasEntityTypes = typeof(EntityDesignerViewModelHasEntityTypes);
				foreach (EntityDesignerViewModelHasEntityTypes eachEntityDesignerViewModelHasEntityTypesInstance in allEntityDesignerViewModelHasEntityTypesInstances)
				{
					if (serializationContext.Result.Failed)
						break;
					if (eachEntityDesignerViewModelHasEntityTypesInstance.GetType() != typeofEntityDesignerViewModelHasEntityTypes)
					{	
						DslModeling::DomainClassXmlSerializer derivedRelSerializer = serializationContext.Directory.GetSerializer(eachEntityDesignerViewModelHasEntityTypesInstance.GetDomainClass().Id);
						global::System.Diagnostics.Debug.Assert(derivedRelSerializer != null, "Cannot find serializer for " + eachEntityDesignerViewModelHasEntityTypesInstance.GetDomainClass().Name + "!");			
						derivedRelSerializer.Write(serializationContext, eachEntityDesignerViewModelHasEntityTypesInstance, writer);
					}
					else
					{	
						DslModeling::ModelElement targetElement = eachEntityDesignerViewModelHasEntityTypesInstance.EntityType;
						DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer(targetElement.GetDomainClass().Id);
						global::System.Diagnostics.Debug.Assert(targetSerializer != null, "Cannot find serializer for " + targetElement.GetDomainClass().Name + "!");			
						targetSerializer.Write(serializationContext, targetElement, writer);
					}
				}
				writer.WriteEndElement();
			}
		}
private static void WriteChildElements ( DslModeling :: SerializationContext serializationContext , global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityDesignerViewModel element , global :: System . Xml . XmlWriter writer ) { global :: System . Collections . ObjectModel . ReadOnlyCollection < EntityDesignerViewModelHasEntityTypes > allEntityDesignerViewModelHasEntityTypesInstances = EntityDesignerViewModelHasEntityTypes . GetLinksToEntityTypes ( element ) ; if ( ! serializationContext . Result . Failed && allEntityDesignerViewModelHasEntityTypesInstances . Count > 0 ) { writer . WriteStartElement ( " " ) ; global :: System . Type typeofEntityDesignerViewModelHasEntityTypes = typeof ( EntityDesignerViewModelHasEntityTypes ) ; foreach ( EntityDesignerViewModelHasEntityTypes eachEntityDesignerViewModelHasEntityTypesInstance in allEntityDesignerViewModelHasEntityTypesInstances ) { if ( serializationContext . Result . Failed ) break ; if ( eachEntityDesignerViewModelHasEntityTypesInstance . GetType ( ) != typeofEntityDesignerViewModelHasEntityTypes ) { DslModeling :: DomainClassXmlSerializer derivedRelSerializer = serializationContext . Directory . GetSerializer ( eachEntityDesignerViewModelHasEntityTypesInstance . GetDomainClass ( ) . Id ) ; global :: System . Diagnostics . Debug . Assert ( derivedRelSerializer != null , " " + eachEntityDesignerViewModelHasEntityTypesInstance . GetDomainClass ( ) . Name + " " ) ; derivedRelSerializer . Write ( serializationContext , eachEntityDesignerViewModelHasEntityTypesInstance , writer ) ; } else { DslModeling :: ModelElement targetElement = eachEntityDesignerViewModelHasEntityTypesInstance . EntityType ; DslModeling :: DomainClassXmlSerializer targetSerializer = serializationContext . Directory . GetSerializer ( targetElement . GetDomainClass ( ) . Id ) ; global :: System . Diagnostics . Debug . Assert ( targetSerializer != null , " " + targetElement . GetDomainClass ( ) . Name + " " ) ; targetSerializer . Write ( serializationContext , targetElement , writer ) ; } } writer . WriteEndElement ( ) ; } }
Serialize all child model elements.
Serialize all child model elements .
// EntityDesignerViewModelHasEntityTypes // Derived relationships will be serialized in full-form. // No need to serialize the relationship itself, just serialize the role-player directly.
serializationContext
DslModeling::SerializationContext
None
element
global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel
EntityDesignerViewModel instance to be serialized.
EntityDesignerViewModel instance to be serialized .
writer
global::System.Xml.XmlWriter
XmlWriter to write serialized data to.
XmlWriter to write serialized data to .