-
Notifications
You must be signed in to change notification settings - Fork 806
Entity Framework AutoIncrementAttribute [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 fields that are auto incremented on server side, e.g. identity columns, or columns using a generator.
Note: the [IdentityAttribute](IdentityAttribute [Mapping]) is a combination of [PrimaryKey](PrimaryKeyAttribute [Mapping]), AutoIncrement and NotNull flags, then in the fields that have Identity attribute is not necessary add this attribute.
public sealed class CustomerRow : Row, IIdRow, INameRow
{
[AutoIncrement]
public Int32? ID
{
get { return Fields.ID[this]; }
set { Fields.ID[this] = value; }
}
See also:
- [Flags Enumeration - Primay key flag](FieldFlags enumeration#autoincrement-flag-see-autoincrementattribute)
- [Identity attribute](IdentityAttribute [Mapping])
Copyright © Serenity Platform 2017-present. All rights reserved.
Documentation | Serene Template | Live Demo | Premium Support | Issues | Discussions