The West Wind Web Store uses a business object architecture that is designed for ease of use, simplicity in design and still provide only a thin layer on top of the ADO.Net architecture of .Net.
The key features of the business object are:
- Simplifies data manipulation
High level methods like Load(), Save(), New() and Delete() etc. deal with all of the logistics of retrieving, changing and saving data. You simply manipulate a DataRow and let the business object deal with writing the data back to the database. In the Web Store 80%+ of the data access is handled through these high level data methods.
- Data member provides easy cached access to data
wwBusiness provides a DataRow member that always has the current single record loaded from operations like, Load(), New() and GetBlankRecord(). In combination with the custom wwWebDataControls you can directly bind to this DataRow to display and then re-capture the data easily from Web Forms.
- Abstracts Data Access
The wwBusiness object architecture abstracts data access and automates the process of retrieving and writing data to the database regardless of backend used. Lower level methods like Execute(), ExecuteNonQuery(), ExecuteScalar() can retreive data without ever writing a line of ADO.Net code. If you want more low level control you can access get references to a Command Factory to manually retrieve data with ADO.Net and still act as part of the business object framework.
- Separate Data Layer Objects
All data access is routed through a Data Object (wwData and its subclasses like wwDataSql, wwDataOdbc). The business object determines which backend to go to at startup and then uses the appropriate data access object to perform the actual database interaction. Since the interfaces are identical and use generic interface references, swapping a back end provider is as easy as setting a property.
(in the current version only the SqlClient implementation is available)
- Light Weight
The data wrappers provided by wwBusiness and wwData/Sql are very lightweight and add very little overhead to the SQL access code. The underlying code goes directly to ADO.Net code and returns standard ADO.Net data structures like DataSets and DataRows that can be used with or without the West Wind Databinding controls.
- Validation Support
The business object includes a ValidationErrors Collection that can be used to validate business logic. The Validate() method of the business object is a great place to validate business rules before saving. Here you can run any business rules that might require data access against the backend and if failures occur handle them in this central method by assigning them to the ValidationErrors collection.
- Integration with Databinding Controls
ASP.Net databinding works but is very simplistic - it doesn't even support unbinding data from the controls back into the datasource. The Web Store ships with a set of two-way databinding controls that make it easy to bind data to any datatype (including object properties and DataRow Fields!) as well as providing the ability to bind the form data back to the underlying data source be it a DataRow, a DataTable/View, DataSet or a plain object property.
The data controls provide minimal formatting options (for displaying data with standard .Net format options) and automatically handle bind back errors based on the data type - for example entering string data into an integer field.
- Easy to use
The wwBusiness class interface is very simple - just a handful of methods and properties that you'll reuse over and over. No complex framework or interdependencies to learn - just a single level class that you subclass from for your business objects.
See alsoBusiness Object Base classes
Comment or report problem with topic