// Copyright (C) Stichting Deltares 2018. All rights reserved. // // This file is part of the application DAM - Clients Library. // // DAM - UI is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using System.Xml.Linq; namespace Deltares.Standard { /// /// Defines the contract of a data transfer object (dto) assembler /// The interface should be used in scenario's where an domain object needs /// to be created from a dto and vice versa. /// The dto in this case can be any class. /// /// The domain object type /// The dto object type public interface IDtoAssembler { /// /// Creates a domain object from dto /// /// The dto to create a domain object from /// The domain object TDomainObject CreateDomainObject(TDataTransferObject dtoObj); /// /// Creates a dto from a domain object /// /// The domain object to create the dto from /// The dto object TDataTransferObject CreateDataTransferObject(TDomainObject domainObj); } /// /// Defines the contract of a data transfer object (dto) assembler /// The interface should be used in scenario's where an domain object needs /// to be created from a dto and vice versa. /// The dto in this case can be any class. /// /// The domain object type /// The dto object type public interface IDtoAssembler { /// /// Creates a domain object from output dto /// /// The dto to create a domain object from /// The domain object TDomainOutputObject CreateOutputObject(TDataTransferObject dto); /// /// Creates a domain object from output dto /// /// The dto to create a domain object from /// The domain object TDomainInputObject CreateInputObject(TDataTransferObject dto); /// /// Creates a dto from a domain input object /// /// The domain object to create the dto from /// The dto object TDataTransferObject CreateDataTransferObject(TDomainInputObject input); } /// /// Defines the contract of a data transfer object (dto) assembler /// The interface should be used in scenario's where an domain object needs /// to be created from a dto and vice versa. /// The dto in this case is a object. /// /// The domain object type public interface IDtoAssembler : IDtoAssembler { string ElementName { get; } } /// /// Defines the contract of a data transfer object (dto) collection assembler /// The interface should be used in scenario's where an domain object collections needs /// to be created from a dto collection and vice versa. /// The dto in this case is a object. /// /// The domain object type in the collection /// The data transfer object type in the collection public interface IDtoCollectionAssembler { /// /// Gets the entity assembler /// IDtoAssembler EntityAssembler { get; } /// /// Create the domain object collection /// /// The dto collection object from which to create domain collection /// The (typed) domain object collection IEnumerable CreateDomainObjectCollection(TDataTransferObject dtoCollObj); /// /// Created the data transfer collection object /// /// The domain collection from which to create the dto collection /// The dto collection object TDataTransferObject CreateDataTransferObject(IEnumerable domainCollObj); } /// /// Defines the contract of a data transfer object (dto) collection assembler /// The interface should be used in scenario's where an domain object collections needs /// to be created from a dto collection and vice versa. /// The dto in this case is a object. /// /// The domain object type in the collection public interface IDtoCollectionAssembler : IDtoCollectionAssembler { string ElementName { get; } } }