Jump to content

.NET Persistence API

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Moshehoadley (talk | contribs) at 09:13, 29 December 2011. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

NPersistence, also reffered to as NPA, is a .NET framework specification that standards Object Relational Mapping (ORM). NPersistence is based on the JPA architecture from the world of JAVA. The NPersistence spec provides a loose coupling between the host application in need of persistence services and the ORM provider that supplies them. NPersistence offers a set of standard APIs with which an application can meet all its persistence needs.

Motivation

Without a standard for ORM services, host applications which need persistence services, use a specific ORM vendor (usually ASP.NET or NHibernate in the .NET framework) by using the vendor specific APIs. This creates a bondage between the host application and the ORM vendor which is very difficult to untie. The host application will need a lot of work in order to switch to another ORM vendor (where the same bondage problem will continue). With NPersistence, a host application will use the NPersistence APIs which are implemented by the different ORM vendors. An ORM vendor may be replaced with zero impact on the host application.

Technology

NPersistence offers the following:

  • A set of APIs for saving, deleting, retrieving and querying entities.
  • Allow persistence of POCO (plain old CLR objects) objects to a database. Such persistable classes are called Entities.
  • Marking classes as entities is done by:
    • Annotations - meta data added to the source code files.
    • An Xml file specifing the entity mapping.

A complete view of NPersistence is provided in the project's website[1] at the reference documentation.

Implementation

NPersistence is a standard/specification and is not an ORM provider by itself. An implementation of the NPersistence spec by an ORM vendor is required in order to use it. Currently, such an implementation exists for the NHibernate ORM provider.




References