Skip to content

Entity Framework IdentityAttribute [Mapping]

Victor Tomaili edited this page May 3, 2021 · 1 revision

(from the official guide)

[namespace: Serenity.Data.Mapping] - [assembly: Serenity.Data]

This is a combination of [PrimaryKey](FieldFlags Enumeration##primarykey-flag-see-primarykeyattribute), AutoIncrement and [NotNull](FieldFlags Enumeration#notnull-flag-see-notnullattribute) flags, which is common for identity columns.

public sealed class CustomerRow : Row, IIdRow, INameRow
{
   [DisplayName("ID"), Identity]
   public Int32? ID
   {
      get { return Fields.ID[this]; }
      set { Fields.ID[this] = value; }
   }
Clone this wiki locally