Language preference:

Phase 2 / Overview: Applying the business rules

Your business rules belong with the Entity classes. Most of the business rules are defined using DataAnnotation attributes that annotate the property and class definitions of the Entity Metadata class.

For example:

using DESDA=PeterBlum.DES.DataAnnotations;
public class Category
   public object CategoryName { get; set; }

   public object Description { get; set; }

DataAnnotation attributes have fixed values for the life of the application. You can also add business rules to the Entity class that you defined in the Business Logic Layer that allow setting values based on the situation.

The tours below cover the DataAnnotation attributes. Some are defined in the .net framework. BLD enhances many and introduces more, to cover a wide variety of business rules.


The DataAnnotation attributes and classes are found in the PeterBlum.DES.DataAnnotations namespace. Microsoft also provides some in its System.ComponentModel.DataAnnotations namespace. While they are supported, the BLD versions are recommended because they are more feature rich.

Your source code file should import the DES namespace, mapping it to the alias "DESDA" as a way to avoid ambigious class names when both declare the identical class name.

using DESDA = PeterBlum.DES.DataAnnotations;

The tours will also explore how to create rules that are determined in code, instead of in attributes.

When Phase 2 is complete, the BLD-based web application has changed based soley on the changes made to the Business Logic Layer.

Tours for Phase 2
  1. DataTypeAttributes - Define real-world types on properties.
  2. ValidationAttributes - Apply validation rules to the values assigned to properties.
  3. DependencyAttribute - Provides a way to enable a validator or a data entry field based on values of other DataFields.
  4. DisplayNameAttribute and DescriptionAttribute - Provide user friendly text for the property name. Offer text for hints and prompts.
  5. DefaultValueAttribute - Provide a default value for the field when adding a record.
  6. InjectionSecurityAttribute - Track and block SQL injection and Cross Site Scripting attacks.
  7. Custom columns and the CalculationDescriptorAttribute - Adding custom columns to your Entity class, some of which may involve a calculation.
  8. ForeignKeyQueryAttribute - Added to foreign key DataFields to define queries that help you build lists from that table.
  9. FilterAttribute - Identify properties that participate in a filtering user interface.
  10. ScaffoldColumnAttribute - Identify columns that participate in Automatic Scaffolding.
  11. ColumnRestrictionAttribute and TableRestrictionAttribute - Apply security restrictions by user roles to columns and tables.
  12. Other DataAnnotations - A review of the remaining DataAnnotation attributes.
  13. Play with the BLD Database Explorer Application - Run the application to see how the changes to business rules impact the user interface.