Reference articles on history, science, culture and more
Encyclopedia

.NET Persistence API

The .NET Persistence API, also referred to as NPA, is a persistence and object-relational mapping (ORM) specification for the .NET framework.

NPA is based on the Java Persistence API (JPA), which is the standard persistence API in the Java world. NPA follows JPA by providing a complete persistence API and a rich set of ORM features.

01Motivation

The main purposes of the .NET Persistence API (NPA) are:

  • To provide a vendor-free persistence API for .NET, making switching from one persistence provider to another easier (avoiding vendor lock-in).
  • To provide a cross-language persistence API by extending the popular Java Persistence API (JPA) to all the .NET programming languages.

02Technology

The main features of NPA include:

  • Object-oriented API for working against databases (usually RDBMS).
  • Query language, based on SQL, for retrieving data from the database in an object oriented manner.
  • Support of persisting POCO (plain old CLR objects) objects (entities).
  • Two methods for marking classes as entity classes and for specifying other settings:
    • Using attributes, meta data is embedded in class definitions in the source code.
    • Using external XML, meta data is specified in external XML resource files.

03Implementations

NPA is a persistence specification. To use NPA an implementation of the specification is required. Persistence and ORM vendors can provide their own implementations of NPA.

First implementation, NPA for NHibernate, was released in December 2011.

Watch videos about .NET Persistence APIExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article .NET Persistence API, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.