.NET Persistence API
This article, .NET Persistence API, has recently been created via the Articles for creation process. Please check to see if the reviewer has accidentally left this template after accepting the draft and take appropriate action as necessary.
Reviewer tools: Inform author |
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
Currently, host application which need persistence services, use a specific ORM vendor (usually ASP.NET or NHibernate in the .NET framework) and using the verdor 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.