2. More About the Object Relational Model
* Customized Business Logic
<< * Type Tables   |   Back to Main   |   * Customized Load Methods >>

View Source
will open in a new window
Implementing Custom Business Logic
Almost no application can be purely code generated. As you develop your application, you will likely have to implement your own custom business rules and functionality.

At the object level, these business rules can be implemented in the custom subclasses. In our example, we make up a fictional business rule of GetPrice for our Project. This GetPrice method takes in a "discount percentage" parameter, and uses it to recalculate the budget, incorporating the discount and adding 8.25% tax.

Note how we can do this within the custom subclass. Any modifications we make in the custom subclass will never be overwritten on subsequent re-generations of the code.

Load a Project Object and Use the New GetPrice Method

Project ID: 3
Project Name: xx
Project Budget: $2500
GetPrice @ 0% Discount: $2706.25
GetPrice @ 10% Discount: $2435.625