Click or drag to resize

IObjectDbEsentSaveT Method

Saves an object into the database, either adding the object if the primary key does not exist, or replacing the data in an existing record with the primary key.

Namespace:  Orthogonal.ObjectDb.Esent
Assembly:  Orthogonal.ObjectDb.Esent (in Orthogonal.ObjectDb.Esent.dll) Version: 4.0.0
Syntax
C#
bool Save<T>(
	T item
)

Parameters

item
Type: T
The object to save in the database.

Type Parameters

T
The type of the object to save into the database.

Return Value

Type: Boolean
True if a record was inserted by the save, False if an existing record was updated.
Exceptions
ExceptionCondition
ArgumentNullException Thrown if item is null.
InvalidOperationException Thrown if any of the following conditions are true.
  • A nullable property type is annonated as non-nullable.
  • An identity property is not the primary key.
  • An identity property is nullable.
  • The primary key property is a nullable type.
  • The primary key property is a long text or long binary type.
  • An identity key column is not type Int32.
  • A property type is unable to be round-tripped as a string.
Remarks
This is a convenience method to allow callers to perform an "insrep" (insert or replace) with minimal coding effort.
See Also