473,385 Members | 1,409 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,385 software developers and data experts.

Working with objects that are dependent on a database connection.

Hi all.
I'm migrating a small app from vb6 to vb.net. It basically deals with
invoices. This is the first time I do this kind of migration, from an
existing app to a new one, the new app should be as "object oriented" as
practically possible.

I have several objects that are dependent on a database connection, such as
the Invoice, the InvoiceDetail, a Currency object (mostly used to get real
time foreign currency exchange rate, and convert between currencies), etc.

A few questions:

1) What would be the recommended way of dealing with database persistence of
those objects? For example, before persisting a new invoice I should be able
to do some validiy/consistency checks, and then insert the corresponding
database lines within the context of a transaction. This is particularly
important, I need the Invoice and its corresponding InvoiceDetail to be
created correctly, or not at all. Is there a framework that will do that for
me?

2) How to correctly model that dependency of the objects on the database? I
will probably have only one database connection active for the client, and
all the operations regarding database access should use this one. Passing a
database connection as a parameter seems quite cumbersome (for example
invoice.persist(myDatabaseConnection)) so I guess all abjects should inherit
from some kind of super object, a "Session" object or such, so they all can
use the database connection when they need to. Am I right? Is there a better
solution?

3) VB.NET has lots of facilities regarding "connecting" GUI controls
directly to database items. I don't know whether I should use the facilities
it provides, or go on a fully separated layer/oriented architecture, which
is what I'm more accustomed to.

Thanks guys, your help is mostly appreciated.
Nov 22 '05 #1
0 883

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

Similar topics

0
by: Nico Raddatz | last post by:
Hi all. I'm migrating a small app from vb6 to vb.net. It basically deals with invoices. This is the first time I do this kind of migration, from an existing app to a new one, the new app should be...
3
by: R Reyes | last post by:
Hi, I'm trying to modularize my database connections a little better and get more out of my project with less code. First check out this common dbOpen() function inside class clsDatabase. I...
1
by: Macca | last post by:
Hi, I have a C# Solution/Application that contain 4 projects. Each of these projects needs at some time to access the same database. I would like to know how to share a single connection...
12
by: Joe Abou Jaoude | last post by:
hi, I have a component that uses a database connection. In the finalizer I dispose the connection because I read in msdn the following: "A type must implement Finalize when it uses...
7
by: Lau Lei Cheong | last post by:
Hello, Actually I think I should have had asked it long before, but somehow I haven't. Here's the scenerio: Say we have a few pages in an ASP.NET project, each of them needs to connect to...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
5
by: Sam | last post by:
Hi all, I have a process which first pulls one time all application IDs from a database and stores them in a table(this process works fine everytime). I then loop through the table, one at a...
4
by: Mike P2 | last post by:
Hi. I'm writing controls that have to query the database, and it bothers me that I might have several of these controls on a page that each create, open, and close their own connection with the...
0
by: satyajit911 | last post by:
Hi, Can anyone please provide me information on how we can check which database objects(views, indexes, etc.) are dependent on a UDF. I want to drop a particular function & recreate a new one....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.