src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/SerializationHelper.cs
/// <summary>
/// Saves the given model root to the given file, with specified encoding.
/// </summary>
/// <param name="serializationResult">Stores serialization result from the save operation.</param>
/// <param name="modelRoot">EntityDesignerViewModel instance to be saved.</param>
/// <param name="fileName">Name of the file in which the EntityDesignerViewModel instance will be saved.</param>
/// <param name="encoding">Encoding to use when saving the EntityDesignerViewModel instance.</param>
/// <param name="writeOptionalPropertiesWithDefaultValue">Whether optional properties with default value will be saved.</param>
Saves the given model root to the given file, with specified encoding.
Saves the given model root to the given file with specified encoding .
internal virtual void SaveModel(DslModeling::SerializationResult serializationResult, global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel modelRoot, string fileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue)
		{
			#region Check Parameters
			if (serializationResult == null)
				throw new global::System.ArgumentNullException("serializationResult");
			if (modelRoot == null)
				throw new global::System.ArgumentNullException("modelRoot");
			if (string.IsNullOrEmpty(fileName))
				throw new global::System.ArgumentNullException("fileName");
			#endregion
			if (serializationResult.Failed)
				return;
			using (global::System.IO.MemoryStream newFileContent = this.InternalSaveModel(serializationResult, modelRoot, fileName, encoding, writeOptionalPropertiesWithDefaultValue))
			{
				if (!serializationResult.Failed && newFileContent != null)
				{	
					using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(fileName, 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(newFileContent.ToArray());
						}
					}
				}
			}
		}
internal virtual void SaveModel ( DslModeling :: SerializationResult serializationResult , global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityDesignerViewModel modelRoot , string fileName , global :: System . Text . Encoding encoding , bool writeOptionalPropertiesWithDefaultValue ) { region  Check Parameters if ( serializationResult == null ) throw new global :: System . ArgumentNullException ( " " ) ; if ( modelRoot == null ) throw new global :: System . ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( fileName ) ) throw new global :: System . ArgumentNullException ( " " ) ; endregion if ( serializationResult . Failed ) return ; using ( global :: System . IO . MemoryStream newFileContent = this . InternalSaveModel ( serializationResult , modelRoot , fileName , encoding , writeOptionalPropertiesWithDefaultValue ) ) { if ( ! serializationResult . Failed && newFileContent != null ) { using ( global :: System . IO . FileStream fileStream = new global :: System . IO . FileStream ( fileName , 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 ( newFileContent . ToArray ( ) ) ; } } } } }
Saves the given model root to the given file, with specified encoding.
Saves the given model root to the given file with specified encoding .
// Only write the content 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 .
modelRoot
global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel
EntityDesignerViewModel instance to be saved.
EntityDesignerViewModel instance to be saved .
fileName
string
Name of the file in which the EntityDesignerViewModel instance will be saved.
Name of the file in which the EntityDesignerViewModel instance will be saved .
encoding
global::System.Text.Encoding
Encoding to use when saving the EntityDesignerViewModel instance.
Encoding to use when saving the EntityDesignerViewModel instance .
writeOptionalPropertiesWithDefaultValue
bool
Whether optional properties with default value will be saved.
Whether optional properties with default value will be saved .