Friday, January 21, 2005

Persistence Framework : An Introduction

Most enterprise applications need access to a relational database. The Microsoft standard for accessing relational databases is the OleDb or using native Managed .NET Provider that utilize SQL as a data manipulation language. This approach of directly accessing a relational database from an object-oriented .NET application was shown to be inefficient and introduces a problem called "object-relational impedance mismatch," or simply "impedance mismatch" for short. Impedance mismatch refers to the differences between object-oriented technology and relational technology. Object technology relies on objects that have data and behavior. Relational technology supports the storing of data in tables and handling these data via a Data Manipulation Language (DML) such as SQL. Furthermore, objects have identity and are traversed using direct access, whereas RDBS tables have a primary key and are related via values in foreign and primary keys. Finally, RDBMS has no equivalent to object inheritance for data and behavior. An approach for solving the impedance mismatch problem is to introduce an abstract layer, called a persistence layer, between the relational database and the object model of the application. This layer fully encapsulates the database access from your business objects. Thus, instead of writing code to handle your database, you are required only to define meta-data that represents how your relational database will be mapped into objects and deal directly with these objects.

No comments: