I read few articles about composite pattern and I want to know whether its applicable in following situation,I found that A Composite Entity object can represent a coarse-grainedobject and all its related dependent objectspublic class PatientRegistrationDTO{    public string RegistrationNo;    public string ID;    public DateTime AdmitDate;    }public class PersonDTO{     public string ID{ get; set; }     public string FullName { get; set; }     public string FirstName { get; set; }}by using these two objects I need to create public class Patient  {        public string ID{ get; set; }        public string FullName { get; set; }        public DateTime AdmitDate;  }Can I use Composite pattern for enterprise applications in here?Is it possible for me to add some class like below?public class PatientDTO{    public static Patient ConvertToEntity(PatientRegistrationDTO pregDTO, PersonDTO person)    {        Patient p = new Patient();        p.ID= pregDTO.ID;        p.FullName = person.FullName;        p.AdmitDate = pregDTO.AdmitDate;        return p;    }}
Design Pattern for enterprise application
design patterns;enterprise architecture;enterprise development
The composite pattern implies that when you call a method perform() on a composite (perform() being part of the interface contract of IComponent), the call is redirected to all its sub-components, until they are leaf elements that do an actual thing. In your case I see absolutely no difference between the coarse and the fine grain, and which entity group/represent others as a composite.So I would say no, the composite pattern really doesn't apply here. the wikipedia class diagram may explicit my point of view: ( in this diagram perform = operation)