- 
                Notifications
    
You must be signed in to change notification settings  - Fork 812
 
Entity Framework PrimaryKeyAttribute [Mapping]
        Victor Tomaili edited this page May 3, 2021 
        ·
        1 revision
      
    (from the official guide)
[namespace: Serenity.Data.Mapping] - [assembly: Serenity.Data]
Set this for primary key fields in table.
Primary key fields are selected on Key column selection mode in [List](List Request) and [Retrieve](Retrieve Request) request handlers.
public sealed class CustomerRow : Row, IIdRow, INameRow
{
   [PrimaryKey]
   public String CustomerID
   {
      get { return Fields.CustomerID[this]; }
      set { Fields.CustomerID[this] = value; }
   }See also:
- [Flags Enumeration - Primay key flag](FieldFlags Enumeration#primarykey-flag-see-primarykeyattribute)
 - [Selection mode](Selection mode)
 
Copyright © Serenity Platform 2017-present. All rights reserved.
Documentation | Serene Template | Live Demo | Premium Support | Issues | Discussions