//----------------------------------------------------------------------- // // Copyright (c) 2009 Deltares. All rights reserved. // // B. Faassen // barry.faassen@deltares.nl // 9-2-2009 // Defines a contract for the data transfer object assembler //----------------------------------------------------------------------- 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; } } }