Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Jon,</p> <p>One of the first things to understand is that if you intend to build layer-based applications, then you should not be storing SQL statements directly within ASPX pages (as the <code>SqlDataSource</code> requires). The <code>SqlDataSource</code> control was built to demonstrate how easy it is to bind and update an application with database data and is not intended to be used in real world applications, because it kinda defeats the purpose of having a BL layer and Datalayer if you are going to store Select/Update/Delete/Insert statements in the ASPX page.</p> <p>The whole purpose of layer-based application design is to encapsulate each layer so that there is no intersection. Each layer interacts with the public interface of the other layers and knows nothing about their internal implementation.</p> <p>The viable alternative, therefore, is to use the <code>ObjectDataSource</code> control. This control allows you to bind directly to a DataLayer or to a Biz logic layer which in turn can call the Datalayer. Binding to a Datalayer directly has the drawback that you will be returning data structures which expose the schema of the database tables (for e.g., DataTables or DataViews).</p> <p>So, the recommended flow of logic is as follows:</p> <p>The ASPX page uses a DataSource control to bind to a BL class. This BL class provides appropriate functions such as <code>GetData, UpdateData, DeleteData and InsertData</code> (with any required overloads) and these functions return strongly typed objects or collections that the <code>ObjectDataSource</code> can work with and display. Each public function in the BL class internally calls into the DataLayer to select/update/delete/insert data to/from the database.</p> <p>An excellent introduction to this layer based design in ASP.NET is provided in the <a href="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/objects.aspx" rel="nofollow noreferrer">Quickstarts</a></p> <p><strong>P.S</strong>: @Andy mentioned generic datalayers that work with all scenarios. See <a href="https://stackoverflow.com/questions/619855/code-review-ado-net-data-access-utility-class-vb/">this question</a> for an example of what it would look like.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload