Forget the re-post I had my clock set 12 hours earlier
Hopefully this will make some sense.. I have a database that has around 50
tables - I thought about putting each table in a class and the data
connection in a class then I could manage the (tables) classes with one data
connection. The business logic would open the database class then whatever
table class is needed, then close the tables and the connection. -- I have
may
doubts whether this would work.
Another way would be to open a data connection in each class. Since
mutiple tables could be open at the same time I would have one data
connection instead of multiple data connections at the same time. If I were
to open one connection for each (table) class, lets say 30 and I had 10 hits
on the web page at the same time, (30 * 10) I could have a possible 300 data
connections (with tables) open at one time. Any rough ideas would be greatly
appreciated.
Finally, just put all the tables and connection into one class.
class1 (open & close database connection)
class2 (table1)
class3 (table 2)
class4 (table 3)
class5 (business logic)
class6 (business logic)
class5: (most tables are needed) (business logic)
-- instances class1 (open)
-- instances class2
-- instances class3
-- instances class4
-- close all classes (tables and connection)
class6: (only 2 tables are needed) (business logic)
-- instances class1 (open)
-- instances class2
-- instances class3
-- close all classes (tables and connection)
Another way:
-- business logic class
-- class2 (open data connection & table)
-- class3 (open data connection & table)
-- class3 (open data connection & table)
-- close classes
Finally way:
-- business logic class
-- class2 (open data connection & all tables)
-- close class 4 1396
Date was wrong --- Sorry!
"Jim Stools" <ji*********@yahoo.com> wrote in message
news:44*********************@news.twtelecom.net... Forget the re-post I had my clock set 12 hours earlier
Hopefully this will make some sense.. I have a database that has around 50 tables - I thought about putting each table in a class and the data connection in a class then I could manage the (tables) classes with one data connection. The business logic would open the database class then whatever table class is needed, then close the tables and the connection. -- I have may doubts whether this would work.
Another way would be to open a data connection in each class. Since mutiple tables could be open at the same time I would have one data connection instead of multiple data connections at the same time. If I were to open one connection for each (table) class, lets say 30 and I had 10 hits on the web page at the same time, (30 * 10) I could have a possible 300 data connections (with tables) open at one time. Any rough ideas would be greatly appreciated.
Finally, just put all the tables and connection into one class.
class1 (open & close database connection) class2 (table1) class3 (table 2) class4 (table 3) class5 (business logic) class6 (business logic)
class5: (most tables are needed) (business logic) -- instances class1 (open) -- instances class2 -- instances class3 -- instances class4 -- close all classes (tables and connection)
class6: (only 2 tables are needed) (business logic) -- instances class1 (open) -- instances class2 -- instances class3 -- close all classes (tables and connection)
Another way: -- business logic class -- class2 (open data connection & table) -- class3 (open data connection & table) -- class3 (open data connection & table) -- close classes
Finally way: -- business logic class -- class2 (open data connection & all tables) -- close class
Connection pooling will handle this for you ...
Cheers,
Greg Young
MVP - C# http://geekswithblogs.net/gyoung
"Jim Stools" <ji*********@yahoo.com> wrote in message
news:44**********************@news.twtelecom.net.. . Date was wrong --- Sorry!
"Jim Stools" <ji*********@yahoo.com> wrote in message news:44*********************@news.twtelecom.net... Forget the re-post I had my clock set 12 hours earlier
Hopefully this will make some sense.. I have a database that has around 50 tables - I thought about putting each table in a class and the data connection in a class then I could manage the (tables) classes with one data connection. The business logic would open the database class then whatever table class is needed, then close the tables and the connection. -- I have may doubts whether this would work.
Another way would be to open a data connection in each class. Since mutiple tables could be open at the same time I would have one data connection instead of multiple data connections at the same time. If I were to open one connection for each (table) class, lets say 30 and I had 10 hits on the web page at the same time, (30 * 10) I could have a possible 300 data connections (with tables) open at one time. Any rough ideas would be greatly appreciated.
Finally, just put all the tables and connection into one class.
class1 (open & close database connection) class2 (table1) class3 (table 2) class4 (table 3) class5 (business logic) class6 (business logic)
class5: (most tables are needed) (business logic) -- instances class1 (open) -- instances class2 -- instances class3 -- instances class4 -- close all classes (tables and connection)
class6: (only 2 tables are needed) (business logic) -- instances class1 (open) -- instances class2 -- instances class3 -- close all classes (tables and connection)
Another way: -- business logic class -- class2 (open data connection & table) -- class3 (open data connection & table) -- class3 (open data connection & table) -- close classes
Finally way: -- business logic class -- class2 (open data connection & all tables) -- close class
Hi,
"Jim Stools" <ji*********@yahoo.com> wrote in message
news:44*********************@news.twtelecom.net... Hopefully this will make some sense.. I have a database that has around 50 tables - I thought about putting each table in a class
There are tools for this, see codesmith for example.
and the data connection in a class then I could manage the (tables) classes with one data connection. The business logic would open the database class then whatever table class is needed, then close the tables and the connection. -- I have may doubts whether this would work.
What you may do is create a class that will handle all access to the DB,
this class export methods that accept a SqlCommand (or ICommand) and execute
it in the DB.
Each class that represent a DB table create its own command and use the
DataAccess class to interact with the DB
Another way would be to open a data connection in each class.
Not a good idea IMHO , you better concentrate all the DB connectivity in one
class. this class should be stateless though. Each time a new request arrive
a connection is created & destroyed.
Thanks for the info..
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:us**************@TK2MSFTNGP05.phx.gbl... Hi,
"Jim Stools" <ji*********@yahoo.com> wrote in message news:44*********************@news.twtelecom.net... Hopefully this will make some sense.. I have a database that has around 50 tables - I thought about putting each table in a class
There are tools for this, see codesmith for example.
and the data connection in a class then I could manage the (tables) classes with one data connection. The business logic would open the database class then whatever table class is needed, then close the tables and the connection. -- I have may doubts whether this would work.
What you may do is create a class that will handle all access to the DB, this class export methods that accept a SqlCommand (or ICommand) and execute it in the DB. Each class that represent a DB table create its own command and use the DataAccess class to interact with the DB
Another way would be to open a data connection in each class.
Not a good idea IMHO , you better concentrate all the DB connectivity in one class. this class should be stateless though. Each time a new request arrive a connection is created & destroyed.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: PC Datasheet |
last post by:
Looking for suggestions ----
A database was designed for a national automobile inspection program. In
it's simplest form, the database has two tables:
TblOwner
OwnerID
<Year/Make/Model owned...
|
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...
|
by: Jim Stools |
last post by:
Hopefully this will make some sense.. I have a database that has around 50
tables - I thought about putting each table in a class and the data
connection in a class then I could manage the (tables)...
|
by: Jim Stools |
last post by:
Forget the re-post I had my clock set 12 hours earlier
Hopefully this will make some sense.. I have a database that has around 50
tables - I thought about putting each table in a class and the...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
|
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...
|
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,...
| |