This is the base business object class that all Web Store classes are subclassed from.
The key features of the business object are its ability to abstract data access via simple access methods like Load(), New(), Save() and Delete() and the ability to provide validation rules. There's also built-in support for building and using child lists easily for things like LineItems that often exist as individual items (LineItem) or as a group (LineItems).
There's more info on the full feature set of this object in the topic.
System.MarshalByRefObject
Westwind.BusinessObjects.wwBusiness
public class wwBusiness : object
Class Members
Member | Description | |
---|---|---|
StatusMessage |
Event hook that can be used to pass status messages from the business object to the presentation layer. | |
CachedDataAdapter |
Cached DataAdapter object. This object is cached the first time a Save() call is made - if multiple Save() occur only one trip is made to the server to retrieve Schema information. | |
BeginTransaction |
Begins a Transaction for the current business object. All operations performed on this business object are handled within the context of this transaction until CommitTransaction or RollBackTransaction is called. public IDbTransaction BeginTransaction( IsolationLevel Isolation ); public IDbTransaction BeginTransaction(); |
|
Close |
Closes the current database connection explicitly. public virtual bool Close(); |
|
CommitTransaction |
Commits a transaction for the current business object. public bool CommitTransaction(); |
|
CreateCommand |
Creates a SQL Command object object that you can execute SQL commands with and add parameters to. Provide at least a SQL statement. public virtual IDbCommand CreateCommand( string Sql ); |
|
CreateNewId |
Creates a new ID field. This methods is used by the New() method internally, but can also be used explicitly to retrieve new keys. public virtual object CreateNewId(); |
|
CreateParameter |
Returns a Sql Parameter object public virtual IDbDataParameter CreateParameter( string ParameterName ); public virtual IDbDataParameter CreateParameter( string ParameterName, |
|
Delete |
Deletes a record in the table by integer PK. public virtual bool Delete( int PK ); public virtual bool Delete( string PK ); public virtual bool Delete( Guid PK ); public virtual bool Delete(); |
|
Execute |
This the core SQL execution method that returns a DataTable in a Dataset. public int Execute( string Sql, public int Execute( IDbCommand SqlCommand, public int Execute( string SqlCommand, |
|
ExecuteNonQuery |
Executes a non-query operation that doesn't return any result set. public int ExecuteNonQuery( IDbCommand SqlCommand, public int ExecuteNonQuery( IDbCommand SqlCommand ); public int ExecuteNonQuery( string Sql ); public int ExecuteNonQuery( string Sql, |
|
ExecuteReader |
Executes a Sql command and returns a DataReader object. public IDataReader ExecuteReader( IDbCommand SqlCommand ); public IDataReader ExecuteReader( string SqlCommand ); |
|
ExecuteScalar |
Executes a function that returns a single value in a data table. The value is returned as an variant object or null on failure. public object ExecuteScalar( IDbCommand SqlCommand ); public object ExecuteScalar( string Sql ); |
|
Exists |
Checks to see if a record exists already by pk public bool Exists( int Pk ); |
|
GetBlankRecord |
Retrieves an empty record from the database. Note this will be completely blank, with no PK created by default as with New(). NewNew public virtual bool GetBlankRecord(); |
|
GetDetailRow |
Returns a specific row from the detail table. Shorthand function to avoid continual object traversals. public virtual DataRow GetDetailRow( int Index ); |
|
GetDetailTable |
Returns a detail table for one to many items by returning the Name of the table named the table plus _LIST (wws_lineItems_LIST) public virtual DataTable GetDetailTable(); |
|
GetProperty |
Retrieves data from the XML field if available. public virtual string GetProperty( string Key ); |
|
Load |
Loads a DataRow object into the oData member based on the Int pk passed A new comment public virtual bool Load( int Pk ); public virtual bool Load( string Pk ); public virtual bool Load( Guid Pk ); |
|
LoadDataAdapterCommands |
Use this method to preload the DataAdapter's Insert, Update Delete Commands. The default delegates to the Data object and its public virtual IDbDataAdapter LoadDataAdapterCommands(); |
|
LoadDetailItems |
Loads a set of child items in a one-to-many relationship into a table named the table plus _LIST (wws_lineItems_LIST) public virtual int LoadDetailItems( int ParentPk, public virtual int LoadDetailItems( string ParentPk, |
|
New |
Loads a DataRow object into the Data member based on the PK passed. public virtual bool New( bool NoNewId ); public virtual bool New(); |
|
Open |
Opens and sets up a connection for a query. public virtual bool Open(); |
|
RollbackTransaction |
Rolls back a transaction for the current business object. public bool RollbackTransaction(); |
|
Save |
Saves the current DataRow member table to the data source. This is the table named by the TableName property. public virtual bool Save(); |
|
SaveTable |
Saves a table from the current DataSet member to the database public virtual bool SaveTable( string Tablename, public virtual bool SaveTable( string Tablename ); public virtual bool SaveTable( string Tablename, |
|
SetAsChildObject |
Creates a child business object by passing child based property settings to the child object. public virtual void SetAsChildObject( wwBusiness ChildObjectRef ); |
|
SetError |
Error setting method. public void SetError( string ErrorMessage ); public void SetError(); |
|
SetProperty |
Sets a property in the XML field in the table if available. public virtual void SetProperty( string Key, |
|
SetTransaction |
Assigns an existing Transaction to the current business object. If the transaction is null this method doesn't do anything so it is safe to call with any object. public void SetTransaction( IDbTransaction ParentTransaction ); |
|
Validate |
Validate() is used to validate business rules on the business object. Generally this method consists of a bunch of if statements that validate the data of the business object and adds any errors to the wwBusiness.ValidationErrors collection. public virtual bool Validate(); |
|
AutoValidate |
Determines whether the Save method automatically calls the Validate method to validate the business data. | |
ConnectionString |
Connection string to the database | |
ConnectType |
Connection Type for data member. Only Sql Server/MSDE is implemented at the moment. | |
Data |
Internal reference to the Data Access Class. This object is exposed here primarily to allow low level control but it's recommended that you use wwBusiness methods for most things. | |
DataRow |
Data member that gets set after a Load operation. Returns a DataRow object that can be accessed via loBus.Data["fieldname"] | |
DataSet |
Reference to a Dataset object contains the results of the current query or row. | |
Error |
Error flag - set if an error occurs. | |
ErrorMessage |
Error Message set if an error occurs. | |
ExecuteWithSchema |
Determines whether DataAdapter retrievals return extra schema information. | |
LastSql |
The content of the last SQL statement sent to Execute() | |
NewRowBlankValues |
Determines whether new rows are initialized non-null values when a new record is created. Strings are initialized to "", numbers to 0, bool to false, Dates to mindate etc. | |
Pk |
Wrapper field that allows retrieving the PK a little bit easier. Note this value maps to the PkField entry in the current DataRow. | |
PkField |
Name of the Primary Key field. Must be an integer field. Default is 'pk'. | |
PkType |
Determines the type of the Primary Key | |
Tablename |
Base file name for the underlying database table that this business object is based on. Generally this table's structure will be the structure of the DataRow member. | |
ValidationErrors |
A collection that can be used to hold errors. This collection is set by the AddValidationError method. |
Requirements
Namespace: Westwind.BusinessObjectsAssembly: wwbusiness.dll
© West Wind Technologies, 1996-2018 • Updated: 12/07/05
Comment or report problem with topic