Thursday, March 11, 2010
Building Queries
Minimize
There are several ways to load data into your business objects.


Method 1 - LoadByPrimaryKey
  1. Automatically generated for you in your business object.
  2. Calls the "Get" version stored procedure (i.e. daab_GetEmployees).
  3. All the columns contained in the table's primary key become parameters to the function. You must specify a value for all fields in the primary key in order to return one row.

Method 2 - LoadAll

  1. Automatically generated for you in your business object.
  2. Calls the "GetAll" version stored procedure (i.e. daab_GetAllEmployees).
  3. Returns all rows in the database table.

Method 3 - Dynamic Queries

  1. Used to create custom queries. (see the Dynamic Query tutorial)
  2. Queries are created in code without writing SQL (which is not portable across databases).

Method 4 - LoadFromSql

  1. Used in your concrete classes to call custom queries.
  2. Can be used with both stored procedures and inline SQL.

Method 5 - QuerySource

  1. Used in conjunction with dynamic queries to load the business object from an alternate data source, such as a view.
  2. If the alternate data source is a superset of the columns defined in the business object, you can still Save the business object.

Method 6 - LoadFromSqlNoExec

  1. Used to call a custom query without affecting the business object's contents.
  2. Can be used with both stored procedures and inline SQL.


Method 7 - LoadFromSqlScalar

  1. Used to return a value from a custom query without affecting the business object's contents.
  2. Can be used with both stored procedures and inline SQL.


Method 8 - LoadFromSqlReader

  1. Used to return an IDataReader from a custom query without affecting the business object's contents.
  2. Can be used with both stored procedures and inline SQL.
Last updated: 01/23/2007

Print  

Privacy Statement  |  Terms Of Use
© 2007 Noonan Consulting Inc.