Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/DtoDocumentAssembler.cs =================================================================== diff -u -r3893 -r4000 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/DtoDocumentAssembler.cs (.../DtoDocumentAssembler.cs) (revision 3893) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/DtoDocumentAssembler.cs (.../DtoDocumentAssembler.cs) (revision 4000) @@ -43,24 +43,26 @@ /// Sets the element name /// The text reader stream for reading in ther xsd file which is embedded as an resource public DtoDocumentAssembler(string elementName, string elementNamespace, string embeddedXsdPath) - : this(elementName, elementNamespace, null, null) - { - } + : this(elementName, elementNamespace, null, null) {} /// /// Initializes a new instance of the DtoDocumentAssembler class /// /// Sets the element name /// The text reader stream for reading in ther xsd file which is embedded as an resource public DtoDocumentAssembler(string elementName, string elementNamespace, - DtoAssembler inputAssembler, + DtoAssembler inputAssembler, DtoAssembler outputAssembler) { if (elementName == null) + { throw new ArgumentNullException("elementName"); + } if (elementNamespace == null) + { throw new ArgumentNullException("elementNamespace"); + } ElementName = elementName; ElementNamespace = elementNamespace; @@ -73,12 +75,12 @@ /// /// Gets the xml element name /// - public string ElementName { get; private set; } + public string ElementName { get; } /// /// Gets or sets the namespace value for the element /// - public string ElementNamespace { get; private set; } + public string ElementNamespace { get; } /// /// Gets the xml schema (if any) @@ -95,12 +97,35 @@ /// public DtoAssembler OutputAssembler { get; set; } + public TDomainOutputObject CreateOutputObject(string fileName) + { + return CreateOutputObject(CreateDocument(fileName)); + } + + public TDomainInputObject CreateInputObject(string fileName) + { + return CreateInputObject(CreateDocument(fileName)); + } + + private XDocument CreateDocument(string fileName) + { + if (!fileName.HasValidStringValue()) + { + throw new ArgumentNullException("fileName"); + } + + XDocument doc = XDocument.Load(fileName); + return doc; + } + #region IDtoAssembler Members public virtual TDomainOutputObject CreateOutputObject(XDocument dtoObject) { if (dtoObject == null) + { throw new ArgumentNullException("dtoObject"); + } if (OutputAssembler != null) { @@ -112,13 +137,15 @@ return OutputAssembler.CreateDomainObject(el); } - return default(TDomainOutputObject); + return default; } public virtual TDomainInputObject CreateInputObject(XDocument dtoObject) { if (dtoObject == null) + { throw new ArgumentNullException("dtoObject"); + } if (InputAssembler != null) { @@ -130,7 +157,7 @@ return InputAssembler.CreateDomainObject(el); } - return default(TDomainInputObject); + return default; } public virtual XDocument CreateDataTransferObject(TDomainInputObject dtoObject) @@ -165,24 +192,5 @@ } #endregion - - public TDomainOutputObject CreateOutputObject(string fileName) - { - return CreateOutputObject(CreateDocument(fileName)); - } - - public TDomainInputObject CreateInputObject(string fileName) - { - return CreateInputObject(CreateDocument(fileName)); - } - - private XDocument CreateDocument(string fileName) - { - if (!fileName.HasValidStringValue()) - throw new ArgumentNullException("fileName"); - - XDocument doc = XDocument.Load(fileName); - return doc; - } } } \ No newline at end of file