Index: DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.tex =================================================================== diff -u -r2052 -r2053 --- DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.tex (.../DAM Engine - Technical Design.tex) (revision 2052) +++ DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.tex (.../DAM Engine - Technical Design.tex) (revision 2053) @@ -768,6 +768,37 @@ %------------------------------------------------------------------------------ \chapter{XML Serialization} \label{chapterXmlSerialization} +\section{Generating serialization code} +\label{sec:GeneratingSerializationCode} + +For the XML serialization a Visual Studio Tool is used. This tool XSD.exe creates objects based on XML schema definitions (*.xsd). To use this tool the following steps should be taken: +\begin{itemize} + \item Start the Developer Command Prompt (for VS2015) and go to the folder containing the XSD's. + \item Create the classes by running the batchfile "GenerateClasses.bat". This generates 2 source files containing the generated objects (DamInput.cs and DamOutput.cs) +\end{itemize} +The batchfile contains the 2 following commands: \newline +\texttt{xsd /c /l:cs /n:Deltares.DamEngine.Io.XmlInput DamInput.xsd}\newline +\texttt{xsd /c /l:cs /n:Deltares.DamEngine.Io.XmlOutput DamOutput.xsd}\newline\newline +The classes in the generated source files can be serialized into XML strings using the .NET library class XmlSerializer, which is part of the System.Xml.Serialization assembly. \newline +The following classes are used for transferring the Dam Engine data model into the serializer objects and back: +\begin{itemize} + \item FillDamFromXmlInput + \item FillXmlInputFromDam + \item FillDamFromXmlOutput + \item FillXmlOutputFromDam +\end{itemize} + +\section{Changing the XSD definition} +\label{sec:ChangingTheXsdDefinition} + +When the interface has to be changed because parameters are added, changed or removed you can do that as follows: +\begin{itemize} + \item Change the XSD. + \item Regenerate the serializer objects. + \item Adapt the transfer objects. +\end{itemize} +\emph{Note: DO NOT manually change the code of the generated objects DamInput.cs and DamOutput.cs, because the changes will be lost when these files are regenerated!} + %------------------------------------------------------------------------------ \chapter{Adding a Failure Mechanism} \label{chapterAddingFailureMechanism} Adding a new failure mechanism to \ProgramName is something that should be releative easy to do. The architecture of \ProgramName has been setup in a way that all failure mechanism specific code is put as much as possible in 1 place. Index: DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.pdf =================================================================== diff -u -r2052 -r2053 Binary files differ