How many datatable/adapter should be put in a DataSet?

G

Guest

What's the best practise to put DataTables in DataSet designer? Should it be
partitioned by Business Logic Layer or one for each database table? or
something in between?

Thanks,
 
W

W.G. Ryan [MVP]

Whew we could start a religious war over this one I'm sure. Personally, If
data is related in the database, I'll typically stick it in the same dataset
as long as I need it. Sticking a table in there doesn't mean you have to
fill it so you can make that determination at runtime. You definitely don't
want to go filling and storing data you don't need.

I've worked at a place that had a typed dataset for every query. It worked,
but it was a real pain in the butt to maintain mainly b/c of naming
collissions. At aminimum though, if they are related in the db and you're
going to update them, I'd probably lean heavily toward the same dataset.
This way you can use constraints and be fairly sure your updates will work.
That and it's logically grouped.
 
R

Robbe Morris [C# MVP]

In .net 2.0, I prefer to use the ado.net code generator
below. It does a nice job of auto populating class properties
in generic lists and separates the database layer from the
the business layer.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top