Implementing a Generic Data Transfer Object in C#
page 2 of 4
by Joydip Kanjilal
Average Rating: 
Views (Total / Last 10 Days): 65048/ 143

Introducing Data Transfer Object

A Data Transfer Object (DTO) is one that can be used to pass data across the layers of an application. In this article I will demonstrate how we can implement a generic Data Transfer Object that can be used in lieu of DataSet, DataTable or even Custom Business Entity instances to transfer data through the layers of an application.

This implementation of the DTO comprises of a generic Business Entity that can be a DataSet instance, a DataTable instance, a Custom Business Entity instance, etc. as the data container. The instances of the DTO are in turn stored in a DTO Register, which actually is a hash table that stores the DTO instances as key - value pairs, the key being the hash code of the DTO instance and the value being the DTO instance itself. This hash code is actually used to pass data across the layers of the application. Such a design promotes loose coupling, flexibility and re-usability in your architecture. I have used generics in this design to use any business entity instance as a data container.

View Entire Article

User Comments

No comments posted yet.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2019  |  Page Processed at 2019-07-17 10:46:11 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search