Where should I use disconnected architecture approach?

Technology CommunityCategory: ADO.NETWhere should I use disconnected architecture approach?
VietMX Staff asked 3 years ago

I would choose disconnected Data Access i.e. Dataset for below points.

  • If a row set is intended to be bound to more than one read-only ASP.NET server control, you should consider using a Dataset instead. If a Data Reader was bound to more than one control (such as three Dropdown List controls), the same query would hit the database three times since the Data Reader can only move forward. The Dataset also works well when a row set must be persisted between page calls to the Session or Cache objects.
  • Another good use of the Dataset is the situation in which data must be retrieved and a complex action performed on each row. For example, an application might retrieve a hundred stock and mutual fund symbols from a 401k table that needs to be edited. This data might have to include the stock and mutual fund prices on screen, as well. A Dataset could be used to store the row set and some code could loop through the Dataset and perform a lookup of each stock’s price through a third-party Web service.
  • Finally, one of the more compelling reasons to use a DataSet instead of a DataReader is that the DataSet can be serialized when the rowset needs to be passed around a network or the Internet. A Data Reader cannot be serialized to XML due to its connected nature.