Click or drag to resize

IPersistableTypeT Interface

Generic interface describing an entity that can be persisted to a database.

Namespace:  Neon.Data
Assembly:  Neon.Common (in Neon.Common.dll) Version: 2.14.0
public interface IPersistableType<T> : IPersistableType
where T : class, new(), IRoundtripData

Type Parameters

Specifies the data type being persisted.

The IPersistableTypeT type exposes the following members.

Public property__T
Identifies the entity type.
(Inherited from IPersistableType.)
Public method__Load
Loads the entity properties from the backing JObject or from the optional JObject passed.
(Inherited from IPersistableType.)
Public method__Save
Persists the object properties to the backing JObject.
(Inherited from IPersistableType.)
Public methodGetKey

Returns the Couchbase or other database key to be used to persist or retrieve the entity. By convention for Couchbase, this key includes the entity type plus the unique key formatted like entity-type::unique-key. For example:


This identifies the document as a user with unique ID as 122330. Document IDs are formatted like this so that we'll be able to take advantage of document filtering by type when we've enabled Couchbase cross datacenter replication.

(Inherited from IPersistableType.)

All entities must implement the __T property such that it returns the bucket unique string that identifies the entity type. This string will be used to distinguish entity types within a Couchbase bucket.

This interface supports the related concepts of entity key and ref. The entity key is the string used to persist an entity instance to Couchbase. By convention, this string is generally prefixed by the entity type and then is followed by instance specific properties, a UUID, or a singleton name.

Entity ref is the value that other entities can use to reference an entity instance. This could be the same as the entity key but typically without the entity type prefix for brevity,

As a convention, many IPersistableTypeT implementations also have a staticGetKey(...) method that returns the Couchbase key for an entity based on parameters passed.

See Also