Click or drag to resize

IObjectDbEsentInsertT Method

Inserts a single object into the database. Non identity primary key property value(s) must be set. All public readable and writable property values of the inserted item object are saved. An exception is thrown if the primary key already exists.

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

Parameters

item
Type: T
The item to insert into the database.

Type Parameters

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

Return Value

Type: T
A reference to the item argument. Any identity property value will be set with the auto-generated unique key value.
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.
See Also