Insert Record

Syntax

Insert(entity);

Arguments

entity

T

Entity that should be inserted into the repository.

It needs to be of the same type as the records of the data table it will be inserted into.

This parameter must not be empty.

Description

Inserts a new record into the repository.

Before calling the function, you need to create a new instance of the respective Entity object with the values you want it to have. (To generate a new Primary Key value, use the function "NewID" that is explained in the article "Generate Row-Id".)

Example

The following program illustrates the function call after creating the record to be inserted:

var orderInstance = new ProductionOrder()
{
    ID = repo.NewID(x => x.ID),
    ProductID = "ADAM-567-BTO",
    Timestamp = DateTime.Now,
    //...
};

repo.Insert(orderInstance);

Function will insert the newly created Production Order "orderInstance" into the repository "repo".

Last updated