473,326 Members | 2,438 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,326 software developers and data experts.

Datasets and business objects

Hi,

In my web application, I need object-relational mapping. I would have liked
to take advantage of the datasets while keeping encapsulation of the data. I
thought about having a protected dataset attribute in my business objects
classes and creating properties to access each column. Thus, I will be able
to update and insert data without writing SQL code.

Do you see drawbacks to this approach ?

What if I decided to keep some business objects in session (the web
application won't be very stressed) ?

Thanks.

Fred
Nov 18 '05 #1
3 1410

Hi Fred,

Simple answer to this is not to re-invent the wheel. I've been revealing
datasets to the outside world for quite a while now without any problems.
If you've analysed you're system using UML (if not learn it quick...makes
life a whole load easier), you'll begin to appreciate that objects can be
both data bound and non-data bound at the same time.

For instance you may have an object called clsPerson. This has attributes
like Surname, Forename, Gender , date of birth etc etc. You also want it to
insert and update the equivalent record in the table tbPerson, so you have a
method called Save that either calls Insert or Update and uses the data in
the attributes to do this. A typical data bound object would have a routine
called GetPerson(PersonID), which picks up the data from the tbPerson and
populates the attributes for when you want to view data.

In a typical system you may have a screen that shows a list of people, from
which you select one person which you wish to show/edit the details. The
above object services the latter part of this, but doesn't obviously help
with the list....wrong! The class clsPerson, can just as easily have a
method called GetPersonList which returns a dataset. This method doesn't
care if the attributes have any values in...this is classic non-data bound
object (sometimes called helper objects). Whats more it all uses the same
connection structure as I've described before so that you an just use the
one connection in all of your objects.

If you're not using UML, then you're not going to be able to get the best
out of any OOP system.

I would avoid getting too many objects in memory. For a start you're at the
mercy of timeouts and other such nonsense. If you're application isn't that
demanding, don't worry about making too many requests to the database. The
key here is the connection objects (see previous answer).

Cheers...P

"Frédéric Mayot" <to**@toto.com> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Hi,

In my web application, I need object-relational mapping. I would have liked to take advantage of the datasets while keeping encapsulation of the data. I thought about having a protected dataset attribute in my business objects
classes and creating properties to access each column. Thus, I will be able to update and insert data without writing SQL code.

Do you see drawbacks to this approach ?

What if I decided to keep some business objects in session (the web
application won't be very stressed) ?

Thanks.

Fred

Nov 18 '05 #2
Fred,

Looks like you are on the right track. I am doing something similar in my
applications. Note, that if you are using typed datasets, Visual Studio
creates a lot of useful classes for you and all properties are already
there, you don't need to write your own code for that.

I don't think keeping datasets in session is a good idea. That's what
database server is for.

Eliyahu

"Frédéric Mayot" <to**@toto.com> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Hi,

In my web application, I need object-relational mapping. I would have liked to take advantage of the datasets while keeping encapsulation of the data. I thought about having a protected dataset attribute in my business objects
classes and creating properties to access each column. Thus, I will be able to update and insert data without writing SQL code.

Do you see drawbacks to this approach ?

What if I decided to keep some business objects in session (the web
application won't be very stressed) ?

Thanks.

Fred

Nov 18 '05 #3
You may want to check out Rocky Lhotka's CSLA framework for Business
objects.
The book is an EXCELLENT read.

I just completed a large ASP.Net project using CSLA. Works great.

http://www.lhotka.net/ArticleIndex.a...ea=CSLA%20.NET
--
Joe Fallon


"Frédéric Mayot" <to**@toto.com> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Hi,

In my web application, I need object-relational mapping. I would have liked to take advantage of the datasets while keeping encapsulation of the data. I thought about having a protected dataset attribute in my business objects
classes and creating properties to access each column. Thus, I will be able to update and insert data without writing SQL code.

Do you see drawbacks to this approach ?

What if I decided to keep some business objects in session (the web
application won't be very stressed) ?

Thanks.

Fred

Nov 18 '05 #4

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

Similar topics

5
by: Brian Kiser | last post by:
What is Microsoft's stance on developing business objects vs datasets when creating n-tier apps. Is anyone doing business objects? It appears that most articles from MS recommend passing...
0
by: Natehop | last post by:
I've been attempting to design an n-tiered framework leveraging .NET's strongly typed Dataset. My Framework will serve as the foundation to several client apps from Windows applications to web...
1
by: Andrew | last post by:
I'm a long time VB6/ADO and Java developer new to ADO.NET. I'm trying to decide on best practices and I'd appreciate any assistance. I have one specific question and another more general...
3
by: Rob Thomas | last post by:
Hi, I've been tasked to come up with a new architecture for a large application at one of my customer's sites. In the past, I have developed multi-tier applications whereby the business...
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
4
by: Burt | last post by:
I'm working on a Windows app that pulls data from SQL Server, displays it on various forms and grids, and allows the user to update, insert, delete data. Some but not much business logic, just...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.