473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Passing data around inside applications

Hi,

In my application I get lots of different sorts of information from
databases. As such, a lot of information is stored in DataSets and DataTable
objects.

Up until now, I have been passing around chunks of data in
DataTables/DataSets, simply because that was the format that they were in
when the data was taken from the database. Now, I know this maybe a pretty
silly question with a standard "it depends" answer, but I'm going to throw
it open for comments anyway:

Should I keep passing around DataSets and DataTables because it's
convienient or, should I make classes to store the information and pass
instantiations of those classes around instead?

Essentially, I am wondering if it is poor form, to pass information around
in DataSets etc, or whether it doesnt really matter.

Thanks

Simon
Nov 15 '05 #1
3 4726
I suggest following article:

Designing Data Tier Components and Passing Data Through Tiers
http://tinyurl.com/2706
Summary: Learn how to best expose your data to Microsoft .NET applications
and how to implement an effective strategy for passing data between the
tiers in a distributed application. (65 printed pages)

Representing Business Entities
Each Data Access Logic Component deals with a specific type of business
entity. For example, the Customer Data Access Logic Component deals with
Customer business entities. There are many different ways to represent
business entities, depending on factors such as the following:

a.. Do you need to bind business entity data to controls in a Microsoft
Windows® form or on an ASP.NET page?
b.. Do you need to perform sorting or searching operations on the business
entity data?
c.. Does your application deal with business entities one at a time, or
does it typically deal with sets of business entities?
d.. Will you deploy your application locally or remotely?
e.. Will the business entity be used by XML Web services?
f.. How important are nonfunctional requirements, such as performance,
scalability, maintainability, and programming convenience?
This document outlines the advantages and disadvantages of the following
implementation options:

a.. XML. You use an XML string or an XML Document Object Model (DOM)
object to represent business entity data. XML is an open and flexible data
representation format that can be used to integrate diverse types of
applications.
b.. DataSet. A DataSet is an in-memory cache of tables, obtained from a
relational database or an XML document. A Data Access Logic Component can
use a DataSet to represent business entity data retrieved from the database,
and you can use the DataSet in your application. For an introduction to
DataSets, see "Introducing ADO.NET" in the .NET Data Access Architecture
Guide.
c.. Typed DataSet. A typed DataSet is a class that inherits from the
ADO.NET DataSet class and provides strongly typed methods, events and
properties to access the tables and columns in a DataSet.
d.. Business Entity Component. This is a custom class to represent each
type of business entity. You define fields to hold the business entity data,
and you define properties to expose this data to the client application. You
define methods to encapsulate simple business logic, making use of the
fields defined in the class. This option does not implement CRUD methods as
pass-through methods to the underlying Data Access Logic Component; the
client application communicates directly with the Data Access Logic
Component to perform CRUD operations.
e.. Business Entity Component with CRUD behaviors. You define a custom
entity class as described previously, and you implement the CRUD methods
that call the underlying Data Access Logic Component associated with this
business entity.
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Simon Harvey" <sh856531@microsofts_free_email_service.com> schreef in
bericht news:es*************@TK2MSFTNGP11.phx.gbl...
Hi,

In my application I get lots of different sorts of information from
databases. As such, a lot of information is stored in DataSets and DataTable objects.

Up until now, I have been passing around chunks of data in
DataTables/DataSets, simply because that was the format that they were in
when the data was taken from the database. Now, I know this maybe a pretty
silly question with a standard "it depends" answer, but I'm going to throw
it open for comments anyway:

Should I keep passing around DataSets and DataTables because it's
convienient or, should I make classes to store the information and pass
instantiations of those classes around instead?

Essentially, I am wondering if it is poor form, to pass information around
in DataSets etc, or whether it doesnt really matter.

Thanks

Simon

Nov 15 '05 #2
In .net references are passed around, I encountered this problem when I was
using ASP.Net and found that my DataTable was being changed in the Cache
even though I had set it to a totally new object. The only work around I
found for this is that you can do a table.Copy() to copy the whole table to
a new instance.

So to make a long story short you are probably already passing a reference
of the table around. But if you want something a little more elegant you
might want to create a XSL DataSet that holds all your tables in one
location and then have a static class like Global that has an instance of
the class in a static method. Such as:

private static MyDataSet _mydataset = new MyDataSet();
public static MyDataSet MyData { get { _mydataset; } }

then no matter where you use Global.MyData you will always have one stored
location. But watch out if you get a table from it and start modifing the
table in another class it will also happen in the static one, because the
tables are passed by reference. This was done to save memory on large
tables.

"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message
news:es*************@TK2MSFTNGP11.phx.gbl...
Hi,

In my application I get lots of different sorts of information from
databases. As such, a lot of information is stored in DataSets and DataTable objects.

Up until now, I have been passing around chunks of data in
DataTables/DataSets, simply because that was the format that they were in
when the data was taken from the database. Now, I know this maybe a pretty
silly question with a standard "it depends" answer, but I'm going to throw
it open for comments anyway:

Should I keep passing around DataSets and DataTables because it's
convienient or, should I make classes to store the information and pass
instantiations of those classes around instead?

Essentially, I am wondering if it is poor form, to pass information around
in DataSets etc, or whether it doesnt really matter.

Thanks

Simon

Nov 15 '05 #3
Thanks guys :-)

Simon
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bryan Martin | last post by:
I have a object that is created in a seperate domain which needs to be passed back to the parent class. Because this object is created in a seperate domain if I try to pass the object back to the...
11
by: Arsen Vladimirskiy | last post by:
Hello, If I have a few simple classes to represent Entities such as Customers and Orders. What is the proper way to pass information to the Data Access Layer? 1) Pass the actual ENTITY to...
41
by: laimis | last post by:
Hey guys, I just recently got introduced to data mappers (DTO mapper). So now I have a SqlHelper being used by DTOMapper and then business layer is using DTOMapper when it needs to persist...
2
by: Stephen Bartholomew | last post by:
Hi All, Firstly, apologies to anyone that notices the cross-post: i also posted this in microsoft.public.dotnet.general earlier this week. I have an ecommerce site that resides mainly on an...
3
by: A Ward | last post by:
I am trying to find a way to have multiple seperate ASP.Net applications where I can response.redirect() to a second web application and pass information. From what I have tried: * HTTP-GET - I...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
46
by: ahmed.maryam | last post by:
Hi all, I have 2 C# applications that I need to pass data between. Specifically XML information such as a document or node name. How can I do that? Thanks in advance! ~ Maryam
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.