Documentation
SolutionDeveloperComplianceProjects
  • Getting Started
  • Technology
    • Application Framework
    • Object-Relational Mapping
    • Security Framework
    • Architecture Pattern
    • API Management
  • Environment
    • Development Tool
    • Database Server
    • Web Server
  • PRESENTATION
    • Design Material
    • HTML Helpers
    • Icon Images
    • Custom CSS
    • JQuery Plugin
      • DataTables
      • Tabs
      • Date Picker
      • Calendar
      • Chart
      • Treeview
    • Client Script
      • Open Modal
      • Close Modal
      • Handle return data
      • Load Content
      • Change Hash
      • Change Title
      • Get actual Hash
      • Get Content
      • Update Content
      • Delete Content
      • Get Partial Content
      • Get Partial Content Async
      • Update Partial Content
      • Update Partial Content Async
      • Delete Partial Content
      • Get Action
      • Update Action
      • Delete Action
      • Cascading Dropdown
      • Display Document
    • MVC View
  • BACKEND
    • Base Controller
    • Controller
    • Base Model
    • View Model
    • Class Utility
      • Constant Values
      • Global Properties
      • Option Helper
      • Setting Helper
    • Data Repository
      • Read Columns
      • Read All Columns
      • Read First Record
      • Read by Primary Key
      • Find Record
      • Insert Record
      • Update Record
      • Delete Entity
      • Delete by Criteria
      • Delete by Primary Key
      • Counting Record
      • Check Exist
      • Generate Row-Id
    • Unit Of Work
    • Data Entity
  • Application Features
    • Account Management
    • Navigation Editor
    • Access Control
  • Examples
    • Simple Page
    • Master Detail
    • Editor Template
Powered by GitBook
On this page
  • Syntax
  • Arguments
  • Description
  • Example
  1. BACKEND
  2. Data Repository

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".

PreviousFind RecordNextUpdate Record

Last updated 2 years ago