Disconnected Recordsets vs. DataSets

A

Andrew

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 architectural one:

1. How can you pass around a disconnected DataSet/DataTable, make
changes to it and then pass it into a component for update? The
disconnected DataSet doesn't know it's UPDATE statement and the
DataAdapter is long since gone.

2. My previous n-tier designs encapsulated all data access into a
single component which knew how to load and store Business Objects.
The BOs didn't even have a reference to ADO. How are developers
handling this today? It seems a bit much to be passing around these
complex mini-databases (DataSets).

Thanks in advance.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Andrew,
1. How can you pass around a disconnected DataSet/DataTable, make
changes to it and then pass it into a component for update? The
disconnected DataSet doesn't know it's UPDATE statement and the
DataAdapter is long since gone.

You should re-create the DataAdapter in order to propagate changes to the
DataSet/DataTable back to the database.
2. My previous n-tier designs encapsulated all data access into a
single component which knew how to load and store Business Objects.
The BOs didn't even have a reference to ADO. How are developers
handling this today? It seems a bit much to be passing around these
complex mini-databases (DataSets).

This is very good question by the way! I think you should visit the
Microsoft's Patterns and Practices website to see how Microsoft recommends
to handle this. I personally prefer to use typed DataSets when I don't need
sophisticated calculations/business rules, and I craft a custom Business
Object Layer communicating to a Data Access Layer to persist business
objects otherwise. The BO layer uses rows from typed datasets to store data
internally but exposes usual properties like CustomerName.

There are also commerical and free(?) n-tier application generators
available that do this work for you.
 

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