472,794 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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 4670
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.