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

Generate Row-Id

Syntax

NewID(filter, len, prefix);

Arguments

filter

Expression<Func<T, string>>

Column that contains the ID (Primary Key).

This parameter must not be empty.

null

len

int

Total number of characters ID should consist of (including prefix).

8

prefix

string

null

Description

Generates a new ID value for the Primary Key column that is specified in the parameter filter by taking the ID value of the newest record in the repository and incrementing it by 1.

If parameter len is specified, it will additionally add preceding zeroes until the number of digits/characters equals the number specified in the parameter len. If len is not specified, it will add preceding zeroes until the number of digits/characters equals 8.

If parameter prefix is specified, it will additionally add the inputted string in the beginning of the ID string. If prefix is not specified, it will not add anything else. The adding of the prefix happens before the insertion of additional zeroes, i.e. zeroes will be inserted between prefix and ID number until the total number of digits/characters (including the prefix) equals the specified length.

Usually used when creating a new record to insert into the repository (see "Insert Record").

Example

The following program illustrates the function call:

var newId = repo.NewID(x => x.ID, 10, "EU");

The function will generate the new ID "EU00000120" (for the case that the newest record that is currently in the repository has the Primary Key Value "119") for the Primary Key column "ID" and store it in the variable "newId".

PreviousCheck ExistNextUnit Of Work

Last updated 2 years ago