473,695 Members | 3,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4753
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 "Introducin g 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@micro softs_free_emai l_service.com> schreef in
bericht news:es******** *****@TK2MSFTNG P11.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@micro softs_free_emai l_service.com> wrote in message
news:es******** *****@TK2MSFTNG P11.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
1892
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 parent class (different domain) I receive an error about "File Not Found". I know the object is created successfully and the objects method can be called after loading the object however upon passing it back to the calling class it exploades. I...
11
3178
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 the Data Access Layer method -or- 2) Pass some kind of a unique id to the Data Access Layer method
41
4709
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 object to database or load them back. Everything is working nicely so far. My question is, is it OK practice to use DTOMapper rfom the presentation layer? For instance, if I want to present in HTML format the list of entries in my database, should I...
2
1501
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 unsecure server for browsing the catalogue and only passes the user to a secure area when its time checkout. The secure domain however is not located on the same URL as the unsecure site - it is hosted on a virtual directory of the ISP's secure...
3
1852
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 need to pass more information than I can fit in the address string * HTTP-POST - Can't find a way to read them from ASPX * Session Variables aren't persistent across applications (that I have been successful with)
22
25583
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 compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(cartSet)
12
5328
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 the custom employee class and have built it as a separate library (employee.dll). This employee.dll is being referenced by both the web service and the windows application. I face the following problem when I send this class to the webservice.
7
3303
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 object is a reference type? my code is not proving that. I have a web project i created from a web service that is my object: public class ExcelService : SoapHttpClientProtocol {
46
10430
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
8619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8555
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9112
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4336
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4571
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2994
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.