Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Anybody can explain about the difference between the
POCO and DTO objects in c# with example
and also go through the below link
in the below link having four types to transfer data from one layer to another layer
i cant under the link explanations

Four ways of passing data between layers[^]

What I have tried:

please help me out from the confusion
Posted
Updated 28-May-19 22:14pm

1 solution

DTO describes what an object is used for. POCO describes how it is implemented.

A lot of (old) frameworks require your objects to have a specific base class or implement a specific interface to work.

So if you wanted to use the framework X to store data in your database, then your class must be derived from XBase or implement XInterface. All fine until you want to support multiple storage systems, need another base class for another framework in another layer....

When using framework specific base classes or interfaces is NOT required, we often say the framework works with Plain Old C# Objects.

A DTO is a DataTransferObject. In is just a class that contains no business logic - only data (typically in the form of public properties). It is typically used between layers.

Most DTOs today are implemented as POCO - and I recommend you stick to this as well - but this is certainly no requirement for it to be a DTO. If the object is used for Data Transfer only, then it is a Data Transfer Object no matter how it is implemented.
 
Share this answer
 
Comments
Member 14374813 29-May-19 6:45am    
Really fine with your explanation and I am satisfied with your answer
but in my question, I mentioned about one link in that link
mention 4 types like non-uniform, uniform, entity,hybrid
can you explain on that, please
lmoelleb 29-May-19 8:20am    
From what I can see with a quick glance (I am not going to read all of that in detail) non-uniform just means you have 3 or more layers and do not use the same approach to communicate between them, while in uniform it use the same approach between all layers. From my quick view I do not agree with his definition of entity and DTO, so I will not comment on that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900