HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Identity, date, and time management

Describes managing identities, dates and times.

Identity management

Each data structure saved in the Dynamic Data Store is given an identity. This identity is represented by the EPiServer.Data.Identity class, which contains the following parts:

  • System.Guid, an External ID either supplied by the user of the Dynamic Data Store or generated dynamically.
  • System.Int64, a Store ID generated by the store.

Specific identity management

The implementer of a .NET class that will be stored in the Dynamic Data Store can choose to explicitly manage the ID the objects get when stored. This can be done in the following ways:

  1. Implement the EPiServer.Data.Dynamic.IDynamicData interface.
  2. Implement the EPiServer.Data.Entity.IEntity interface.
  3. Implement a property called ID of the type System.Guid.

See the UsingManagedIdentity class in the DDS sample project for examples of specific identity management.

Implicit identity management (POCO support)

The Dynamic Data Store supports POCO objects. When POCO objects are stored in the Dynamic Data Store, special care needs to be taken when saving (updating) existing objects. Because the Dynamic Data Store does not have an ID it can use to determine if an object is new or existing, it relies on state information held for objects that have been previously loaded through the same instance of the Dynamic Data Store when saving them back.

See the UsingImplicitidentity class in the DDS sample project for examples of implicit identity management.

Date and time management

By default, dates are stored as unspecified, which means it is the responsibility of the data class to convert to local or UTC time.

You can change this behavior by using the EPiServerDataStoreAttribute, for example: [EPiServerDataStore(DatabaseDateTimeKind = DatabaseDateTimeKind.Utc)]. When this is activated, all dates and times are automically converted when loading and saving. When using LINQ, the actual date and time stored in the database is used, no automatic conversion takes place. See also Storing UTC date and time in the database (Legacy).