|
Extending the BO-Layer Topic updated 16-5-2007 |
|
The ability to extend the BO-Layer is one of strongest examples of the power of the GenWise approach to software generation. While the NHibernate Templates manage all the boilerplate source code for you, you can concentrate on defining and implementing the right business logic by adding bits of custom source code in the right places. The BO-Layer (Business Object Layer) is the application layer that is supposed to handle business logic. If you work on an application with GenWise, consider which of your customizations have to do with business rules, and implement those that do by extending the BO-Layer. Typical examples of extending the BO-Layer are:
Example: adding a property to a POCO Class Shown below is a basic example of custom code added to a User Codeblock, enriching the POCO Class for an entity called Customers with a FullAddress property.
See also The Filtering and sorting chapter provides valuable information if you want to implement business rules in Factory Classes. A good example of this is Applying a global filter through GetBasicCriteria. It is recommended to use Unit Testing to ensure that implementation of business rules has been done right. An alternative, easy but limited way of adding properties to POCO Classes is by defining Calculated Columns in the Database Repository. This requires no extra coding in the BO-Layer. The SQL expression used for the Calculated Column must be in the SQL dialect of your database. |