Functional Application Blocks

Enterprise Library consists of the following functional application blocks, which can be used individually or can be grouped together to address a specific cross-cutting concern. This book contains dedicated chapters for each of these functional application blocks; in each chapter we will explore the application block in detail.

  • Data Access Application Block
  • Logging Application Block
  • Exception Handling Application Block
  • Caching Application Block
  • Validation Application Block
  • Security Application Block
  • Cryptography Application Block

Data Access Application Block

Developing an application that stores/retrieves data in/from some kind of a relational database is quite common; this involves performing CRUD (Create, Read, Update, Delete) operations on the database by executing T-SQL or stored procedure commands. But we often end up writing the plumbing code over and over again to perform these operations: plumbing code such as creating a connection object, opening and closing a connection, parameter caching, and so on.

The following are the key benefits of the Data Access block:

  • The Data Access Application Block (DAAB) abstracts developers from the underlying database technology by providing a common interface to perform database operations.
  • DAAB also takes care of the ordinary tasks like creating a connection object, opening and closing a connection, parameter caching, and so on.
  • It helps in bringing consistency to the application and allows changing of database type by modifying the configuration.

We will further dive deep into the Data Access block in Chapter 2,

Logging Application Block

Logging is an essential activity, which is required to understand what's happening behind the scene while the application is running. This is especially helpful in identifying issues and tracing the source of the problem without debugging. The Logging Application Block provides a very simple, flexible, standard, and consistent way to log messages. Administrators have the power to change the log destination (file, database, e-mail, and so on), modify message format, decide on which category is turned on/off, and so on. The Logging block is further discussed in Chapter 3,

Exception Handling Application Block

Handling exceptions appropriately and allowing the user to either continue or exit gracefully is essential for any application to avoid user frustration. The Exception Handling Application Block adapts the policy-driven approach to allow developers/administrators to define how to handle exceptions.

The following are the key benefits of the Exception Handling Block:

  • It provides the ability to log exception messages using the Logging Application Block.
  • It provides a mechanism to replace the original exception with another exception, which prevents disclosure of sensitive information.
  • It provides mechanism to wrap the original exception inside another exception to maintain the contextual information.

We will dive deep into Exception Handling Block in Chapter 4, Exception Handling Application Block.

Caching Application Block

Caching in general is a good practice for data that has a long life span; caching is recommended if the possibility of data being changed at the source is low and the change doesn't have significant impact on the application. The Caching Application Block allows us to cache data locally in our application; it also gives us the flexibility to cache the data in-memory, in a database or in an isolated storage. The Caching block is discussed in detail in Chapter 5, Caching Application Block.

Validation Application Block

The Validation Application Block (VAB) provides various mechanisms to validate user inputs. As a rule of thumb always assume user input is not valid unless proven to be valid. The Validation block allows us to perform validation in three different ways; we can use configuration, attributes, or code to provide validation rules. Additionally it also includes adapters specifically targeting ASP.NET, Windows Forms, and Windows Communication Foundation (WCF). We will explore the Validation block in detail in Chapter 6, Validation Application Block.

Security Application Block

The Security Application Block simplifies authorization based on rules and provides caching of the user's authorization and authentication data. Authorization can be done against Microsoft Active Directory Service, Authorization Manager (AzMan), Active Directory Application Mode (ADAM), and Custom Authorization Provider. Decoupling of the authorization code from the authorization provider allows administrators to change the provider in the configuration without changing the code. The Security block is explored in detail inChapter 7, Security Application Block.

Cryptography Application Block

The Cryptography Application Block provides a common API to perform basic cryptography operations without inclining towards any specific cryptography provider and the provider is configurable. Using this application block we can perform encryption/decryption, hashing, & validate whether the hash matches some text. We will discuss the Cryptography block in detail in Chapter 8, Cryptography Application Block.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.176.72