src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/SerializationHelper.cs
/// <summary>
/// Saves the given model root as a in-memory stream.
/// This is a helper used by SaveModel() and SaveModelAndDiagram(). When saving the model and the diagram together, we want to make sure that 
/// both can be saved without error before writing the content to disk, so we serialize the model into a in-memory stream first.
/// </summary>
/// <param name="serializationResult">Stores serialization result from the save operation.</param>
/// <param name="diagram">EntityDesignerDiagram to be saved.</param>
/// <param name="diagramFileName">Name of the file in which the diagram will be saved.</param>
/// <param name="encoding">Encoding to use when saving the diagram.</param>
/// <param name="writeOptionalPropertiesWithDefaultValue">Whether optional properties with default value will be saved.</param>
/// <returns>In-memory stream containing the serialized EntityDesignerDiagram instance.</returns>
Saves the given model root as a in-memory stream.
This is a helper used by SaveModel() and SaveModelAndDiagram(). When saving the model and the diagram together, we want to make sure that
both can be saved without error before writing the content to disk, so we serialize the model into a in-memory stream first.
Saves the given model root as a in - memory stream . This is a helper used by SaveModel () and SaveModelAndDiagram () . When saving the model and the diagram together we want to make sure that both can be saved without error before writing the content to disk so we serialize the model into a in - memory stream first .
private global::System.IO.MemoryStream InternalSaveDiagram(DslModeling::SerializationResult serializationResult, global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue)
		{
			#region Check Parameters
			global::System.Diagnostics.Debug.Assert(serializationResult != null);
			global::System.Diagnostics.Debug.Assert(diagram != null);
			global::System.Diagnostics.Debug.Assert(!serializationResult.Failed);
			#endregion
			DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(diagram.Store);
			global::System.IO.MemoryStream newFileContent = new global::System.IO.MemoryStream();
			DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(directory, diagramFileName, serializationResult);
			this.InitializeSerializationContext(diagram.Partition, serializationContext, false);
			serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue;
			global::System.Xml.XmlWriterSettings settings = MicrosoftDataEntityDesignSerializationHelper.Instance.CreateXmlWriterSettings(serializationContext, true, encoding);
			using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(newFileContent, settings))
			{
				this.WriteRootElement(serializationContext, diagram, writer);
			}
			return newFileContent;
		}
private global :: System . IO . MemoryStream InternalSaveDiagram ( DslModeling :: SerializationResult serializationResult , global :: Microsoft . Data . Entity . Design . EntityDesigner . View . EntityDesignerDiagram diagram , string diagramFileName , global :: System . Text . Encoding encoding , bool writeOptionalPropertiesWithDefaultValue ) { region  Check Parameters global :: System . Diagnostics . Debug . Assert ( serializationResult != null ) ; global :: System . Diagnostics . Debug . Assert ( diagram != null ) ; global :: System . Diagnostics . Debug . Assert ( ! serializationResult . Failed ) ; endregion DslModeling :: DomainXmlSerializerDirectory directory = this . GetDirectory ( diagram . Store ) ; global :: System . IO . MemoryStream newFileContent = new global :: System . IO . MemoryStream ( ) ; DslModeling :: SerializationContext serializationContext = new DslModeling :: SerializationContext ( directory , diagramFileName , serializationResult ) ; this . InitializeSerializationContext ( diagram . Partition , serializationContext , false ) ; serializationContext . WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue ; global :: System . Xml . XmlWriterSettings settings = MicrosoftDataEntityDesignSerializationHelper . Instance . CreateXmlWriterSettings ( serializationContext , true , encoding ) ; using ( global :: System . Xml . XmlWriter writer = global :: System . Xml . XmlWriter . Create ( newFileContent , settings ) ) { this . WriteRootElement ( serializationContext , diagram , writer ) ; } return newFileContent ; }
Saves the given model root as a in-memory stream.
Saves the given model root as a in - memory stream .
// MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here.
In-memory stream containing the serialized EntityDesignerDiagram instance.
In - memory stream containing the serialized EntityDesignerDiagram instance .
serializationResult
DslModeling::SerializationResult
Stores serialization result from the save operation.
Stores serialization result from the save operation .
diagram
global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram
EntityDesignerDiagram to be saved.
EntityDesignerDiagram to be saved .
diagramFileName
string
Name of the file in which the diagram will be saved.
Name of the file in which the diagram will be saved .
encoding
global::System.Text.Encoding
Encoding to use when saving the diagram.
Encoding to use when saving the diagram .
writeOptionalPropertiesWithDefaultValue
bool
Whether optional properties with default value will be saved.
Whether optional properties with default value will be saved .