/// <summary> /// Saves the given diagram to the given file, with default encoding (UTF-8). /// </summary> /// <param name="serializationResult">Stores serialization result from the save operation.</param> /// <param name="modelRoot">PaginaWeb instance to be saved.</param> /// <param name="modelFileName">Name of the file in which the CanonicalSampleRoot instance will be saved.</param> /// <param name="diagram">DSLBootstrapDiagram to be saved.</param> /// <param name="diagramFileName">Name of the file in which the diagram will be saved.</param> /// <param name="writeOptionalPropertiesWithDefaultValue">Whether optional properties with default value will be saved.</param> public virtual void SaveModelAndDiagram(DslModeling::SerializationResult serializationResult, PaginaWeb modelRoot, string modelFileName, DSLBootstrapDiagram diagram, string diagramFileName, bool writeOptionalPropertiesWithDefaultValue) { this.SaveModelAndDiagram(serializationResult, modelRoot, modelFileName, diagram, diagramFileName, global::System.Text.Encoding.UTF8, writeOptionalPropertiesWithDefaultValue); }
public virtual void SaveModelAndDiagram(DslModeling::SerializationResult serializationResult, PaginaWeb modelRoot, string modelFileName, DSLBootstrapDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (string.IsNullOrEmpty(modelFileName)) throw new global::System.ArgumentNullException("modelFileName"); if (diagram == null) throw new global::System.ArgumentNullException("diagram"); if (string.IsNullOrEmpty(diagramFileName)) throw new global::System.ArgumentNullException("diagramFileName"); #endregion if (serializationResult.Failed) return; // Save the model file first using (global::System.IO.MemoryStream modelFileContent = this.InternalSaveModel(serializationResult, modelRoot, modelFileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (serializationResult.Failed) return; using (global::System.IO.MemoryStream diagramFileContent = this.InternalSaveDiagram(serializationResult, diagram, diagramFileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (!serializationResult.Failed) { // Only write the contents if there's no error encountered during serialization. if (modelFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(modelFileName, 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(modelFileContent.ToArray()); } } } 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()); } } } } } } }
/// <summary> /// Helper method to create and initialize a new PaginaWeb. /// </summary> internal protected virtual PaginaWeb CreateModelHelper(DslModeling::Partition modelPartition) { PaginaWeb model = new PaginaWeb(modelPartition); return model; }
/// <summary> /// Saves the given diagram to the given file, with default encoding (UTF-8), and optional properties with default value will not /// be written out. /// </summary> /// <param name="serializationResult">Stores serialization result from the save operation.</param> /// <param name="modelRoot">PaginaWeb instance to be saved.</param> /// <param name="modelFileName">Name of the file in which the CanonicalSampleRoot instance will be saved.</param> /// <param name="diagram">DSLBootstrapDiagram to be saved.</param> /// <param name="diagramFileName">Name of the file in which the diagram will be saved.</param> public virtual void SaveModelAndDiagram(DslModeling::SerializationResult serializationResult, PaginaWeb modelRoot, string modelFileName, DSLBootstrapDiagram diagram, string diagramFileName) { this.SaveModelAndDiagram(serializationResult, modelRoot, modelFileName, diagram, diagramFileName, global::System.Text.Encoding.UTF8, false); }
/// <summary> /// Saves the given model to the given file, with default encoding (UTF-8). /// </summary> /// <param name="serializationResult">Stores serialization result from the save operation.</param> /// <param name="modelRoot">PaginaWeb instance to be saved.</param> /// <param name="fileName">Name of the file in which the PaginaWeb instance will be saved.</param> /// <param name="writeOptionalPropertiesWithDefaultValue">Whether optional properties with default value will be saved.</param> public virtual void SaveModel(DslModeling::SerializationResult serializationResult, PaginaWeb modelRoot, string fileName, bool writeOptionalPropertiesWithDefaultValue) { this.SaveModel(serializationResult, modelRoot, fileName, global::System.Text.Encoding.UTF8, writeOptionalPropertiesWithDefaultValue); }
private global::System.IO.MemoryStream InternalSaveModel(DslModeling::SerializationResult serializationResult, PaginaWeb modelRoot, string fileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters global::System.Diagnostics.Debug.Assert(serializationResult != null); global::System.Diagnostics.Debug.Assert(modelRoot != null); global::System.Diagnostics.Debug.Assert(!serializationResult.Failed); #endregion serializationResult.Encoding = encoding; DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(modelRoot.Store); global::System.IO.MemoryStream newFileContent = new global::System.IO.MemoryStream(); DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(directory, fileName, serializationResult); this.InitializeSerializationContext(modelRoot.Partition, serializationContext, false); // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = DSLBootstrapSerializationHelper.Instance.CreateXmlWriterSettings(serializationContext, false, encoding); using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(newFileContent, settings)) { this.WriteRootElement(serializationContext, modelRoot, writer); } return newFileContent; }
/// <summary> /// Constructor /// Creates a PaginaWebHasFormulario link in the same Partition as the given PaginaWeb /// </summary> /// <param name="source">PaginaWeb to use as the source of the relationship.</param> /// <param name="target">Formulario to use as the target of the relationship.</param> public PaginaWebHasFormulario(PaginaWeb source, Formulario target) : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(PaginaWebHasFormulario.PaginaWebDomainRoleId, source), new DslModeling::RoleAssignment(PaginaWebHasFormulario.FormularioDomainRoleId, target)}, null) { }
/// <summary> /// Saves the given model root to the given file, with default encoding (UTF-8), and optional properties with default value will not /// be written out. /// </summary> /// <param name="serializationResult">Stores serialization result from the save operation.</param> /// <param name="modelRoot">PaginaWeb instance to be saved.</param> /// <param name="fileName">Name of the file in which the PaginaWeb instance will be saved.</param> public virtual void SaveModel(DslModeling::SerializationResult serializationResult, PaginaWeb modelRoot, string fileName) { this.SaveModel(serializationResult, modelRoot, fileName, global::System.Text.Encoding.UTF8, false); }
public static void SetPaginaWeb(Table element, PaginaWeb newPaginaWeb) { DslModeling::DomainRoleInfo.SetLinkedElement(element, TableDomainRoleId, newPaginaWeb); }
public static DslModeling::LinkedElementCollection<Table> GetTables(PaginaWeb element) { return GetRoleCollection<DslModeling::LinkedElementCollection<Table>, Table>(element, PaginaWebDomainRoleId); }
public static DslModeling::LinkedElementCollection<Formulario> GetFormulario(PaginaWeb element) { return GetRoleCollection<DslModeling::LinkedElementCollection<Formulario>, Formulario>(element, PaginaWebDomainRoleId); }
/// <summary> /// Constructor /// Creates a PaginaWebHasTables link in the same Partition as the given PaginaWeb /// </summary> /// <param name="source">PaginaWeb to use as the source of the relationship.</param> /// <param name="target">Table to use as the target of the relationship.</param> public PaginaWebHasTables(PaginaWeb source, Table target) : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(PaginaWebHasTables.PaginaWebDomainRoleId, source), new DslModeling::RoleAssignment(PaginaWebHasTables.TableDomainRoleId, target)}, null) { }
public static DslModeling::LinkedElementCollection<Inner> GetInners(PaginaWeb element) { return GetRoleCollection<DslModeling::LinkedElementCollection<Inner>, Inner>(element, PaginaWebDomainRoleId); }
public static void SetPaginaWeb(Formulario element, PaginaWeb newPaginaWeb) { DslModeling::DomainRoleInfo.SetLinkedElement(element, FormularioDomainRoleId, newPaginaWeb); }
/// <summary> /// Constructor /// Creates a PaginaWebHasInners link in the same Partition as the given PaginaWeb /// </summary> /// <param name="source">PaginaWeb to use as the source of the relationship.</param> /// <param name="target">Inner to use as the target of the relationship.</param> public PaginaWebHasInners(PaginaWeb source, Inner target) : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(PaginaWebHasInners.PaginaWebDomainRoleId, source), new DslModeling::RoleAssignment(PaginaWebHasInners.InnerDomainRoleId, target)}, null) { }