Click or drag to resize

ObjectDbInsertManyT Method

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

Namespace:  Orthogonal.ObjectDb.Esent
Assembly:  Orthogonal.ObjectDb.Esent (in Orthogonal.ObjectDb.Esent.dll) Version: 4.0.0
Syntax
C#
public int InsertMany<T>(
	IEnumerable<T> items
)

Parameters

items
Type: System.Collections.GenericIEnumerableT
The items to insert into the database.

Type Parameters

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

Return Value

Type: Int32
The total number of items inserted.

Implements

IObjectDbEsentInsertManyT(IEnumerableT)
Exceptions
ExceptionCondition
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
The underlying ESENT database has limited buffer space for transactions, so there is an unpredictable limit on how many objects can be inserted in a single InsertMany method call. Tests show that up to 100 moderately sized objects can be inserted in a single transaction. If the limit is reached, calling applications can split the incoming data into "batches" of an acceptable size.
See Also