How to use typed datasets in 3-tier environment

  • Thread starter Gabriel Lozano-Morán
  • Start date
G

Gabriel Lozano-Morán

What is the proper way of working with typed datasets in a 3-tier
environment? Should I use a common assembly for the typed datasets that can
be referenced in the presentation layer, business logic layer and the data
access layer? I really don't want to add a reference to my data access layer
in my presentation layer.

All help (links to articles, code snippets, ...) is welcome

TIA

Gabriel Lozano-Morán
 
D

David Lei

I usually put the typed dataset objects within the businese logic layer,
Presentation layer has a reference to businese logic layer, thus "knows" all
the available typed dataset objects.

Businese logic layer contains a reference to data access layer, using it to
fill the typed dataset objects and perform businese rules on them.

Presentation layer does not need or should know about the data access layer.
Data access layer should not or need to know anything about the typed
dataset objects.

You can also have a separate assembly containing all your typed dataset
objects,
and reference it in both the presentation and businese layers.

david
 
G

Gabriel Lozano-Morán

Hello David

I think I will go for the common assembly approach by creating a seperate
assembly containing nothing but the typed datasets.

In your reply you said that you use the data access layer to fill the typed
dataset objects. I have added a component class to my data access layer and
I can drag and drop tables from my database and to have the SqlDataAdapters
automatically generated but these SqlDataAdapters are private within the
component. Is there a better approach?

TIA

Gabriel Lozano-Morán
 
D

David Lei

I normally code everything manually so it's very easy to create a
Data Access class and passing typed dataset to it.

The typed DataSet objects don't need to know anything about the
SqlDataAdapter, they are being pass into the Data Access layer and
the DAL will do the rest, insert, update and delete.

Check out the MSDN written Data Access Layer class,
You can download it and use it on your project.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/daab.asp

There maybe some way you can do the same in a VS designer/drag and drop
fashion.
but I'm not familiar with it, coding everything manually has more
flexibilities.

3-tier design is mainly for enterprise level application.
If you don't need it, you don't have to use it.

david
 

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