Home     About PeterBlum.com     Policies     Download a Licensed Product     Newsletter
Peter's Business Logic Driven UI
BLD DataAccessObjects: Business logic for your CRUD actions
Back to Product Overview  |  Next topic

A Data Access Object is a companion class to an Entity class which provides the CRUD ("Create, Read, Update, Delete") methods that operate on the table. These methods exchange Entity class instances with the caller. For example, to add a record, create an Entity instance with property value to write. Then call the Insert (a.k.a. "Create") method of the Data Access Object. When performing a query, the Select (a.k.a. "Read") methods return a list of Entity objects based on the query filters and sort order.

Web Form developers have traditionally created their SQL code for CRUD within the Web Form using either ADO.NET or a DataSource control. This violates our goal of separating business logic from the user interface.

BLD introduces BLD DataAccessObjects to solve this. You create an EntityDAO class for each Entity class, such as ProductDAO for the Products table. It provides default methods for the CRUD actions: Insert, Update, Delete, and Select. You can introduce alternatives that fit your business logic better. More

By using BLD DataAccessObjects, you have a number of advantages:

  • The user interface never contains business logic. Instead, it contains the EntityDAODataSource control which directs the CRUD actions to the appropriate methods on the Data Access Object.
  • It includes a versatile paging and caching mechanism.
  • Its EntityFilter classes let users pass in all kinds of filter rules. More
  • You can use BLD's powerful filtering user interface controls: BLDFilterField, BLDPatternForFilterFields, and BLDFilterSummary. These controls work with EntityFilters classes, which they deliver to your Select method through EntityDAODataSource. This one feature will make building your user interface so much easier.
  • Built in support for Entity Framework, LINQ to SQL, and ADO.NET. Can be extended (like everything in BLD) to support other Data Access Layer technologies.
Should you use BLD DataAccessObjects?

While you get some nice benefits from using BLD DataAccessObjects, you may prefer to use other Data Access Objects that you already have, or write this kind of code in the web form (gasp!).

BLD does not require using the BLD DataAccessObject classes. However, when you do not, you have to extend your own classes to support EntityFilters (which gives you access to the filtering user interface controls).

Back to Product Overview  |  Next topic