src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/SerializationHelper.cs
/// <summary>
/// Saves the given EntityDesignerDiagram to the given file, with specified encoding.
/// </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>
Saves the given EntityDesignerDiagram to the given file, with specified encoding.
Saves the given EntityDesignerDiagram to the given file with specified encoding .
internal virtual void SaveDiagram(DslModeling::SerializationResult serializationResult, global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue)
		{
			#region Check Parameters
			if (serializationResult == null)
				throw new global::System.ArgumentNullException("serializationResult");
			if (diagram == null)
				throw new global::System.ArgumentNullException("diagram");
			if (string.IsNullOrEmpty(diagramFileName))
				throw new global::System.ArgumentNullException("diagramFileName");
			#endregion
			if (serializationResult.Failed)
				return;
			using (global::System.IO.MemoryStream diagramFileContent = this.InternalSaveDiagram(serializationResult, diagram, diagramFileName, encoding, writeOptionalPropertiesWithDefaultValue))
			{
				if (!serializationResult.Failed)
				{
					if (diagramFileContent != null)
					{
						using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(diagramFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None))
						{
							using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding))
							{
								writer.Write(diagramFileContent.ToArray());
							}
						}
					}
				}
			}
		}
internal virtual void SaveDiagram ( DslModeling :: SerializationResult serializationResult , global :: Microsoft . Data . Entity . Design . EntityDesigner . View . EntityDesignerDiagram diagram , string diagramFileName , global :: System . Text . Encoding encoding , bool writeOptionalPropertiesWithDefaultValue ) { region  Check Parameters if ( serializationResult == null ) throw new global :: System . ArgumentNullException ( " " ) ; if ( diagram == null ) throw new global :: System . ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( diagramFileName ) ) throw new global :: System . ArgumentNullException ( " " ) ; endregion if ( serializationResult . Failed ) return ; using ( global :: System . IO . MemoryStream diagramFileContent = this . InternalSaveDiagram ( serializationResult , diagram , diagramFileName , encoding , writeOptionalPropertiesWithDefaultValue ) ) { if ( ! serializationResult . Failed ) { if ( diagramFileContent != null ) { using ( global :: System . IO . FileStream fileStream = new global :: System . IO . FileStream ( diagramFileName , global :: System . IO . FileMode . Create , global :: System . IO . FileAccess . Write , global :: System . IO . FileShare . None ) ) { using ( global :: System . IO . BinaryWriter writer = new global :: System . IO . BinaryWriter ( fileStream , encoding ) ) { writer . Write ( diagramFileContent . ToArray ( ) ) ; } } } } } }
Saves the given EntityDesignerDiagram to the given file, with specified encoding.
Saves the given EntityDesignerDiagram to the given file with specified encoding .
// Only write the contents if there's no error encountered during serialization.
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 .