-
Notifications
You must be signed in to change notification settings - Fork 585
KeyTypes
The KeyType enum allows Dapper Extensions to know how to populate the primary key for your POCOs. When your POCOs are scanned by Dapper Extensions, a type map is created and cached. This type map is used to generate the appropriate SQL in subsequent calls. For example, In order to call, Get, Dapper Extensions must first know what property on the POCO is the identity.
The following KeyTypes are available:
public enum KeyType
{
NotAKey,
Identity,
Guid,
Assigned
}
Any property that is not a primary key will be mapped with this enum value.
Any primary key that is an Integer will be mapped with this enum value. This value instructs Dapper Extensions to allow the database to generate the next available Id.
Any primary key that is an Guid will be mapped with this enum value. This value instructs Dapper Extensions to generate a new Guid for the POCO before database insertion. Dapper Extensions generates COMB Guids (see: GetNextGuid)
Any primary key that is not a Guid or Integer will mapped with this enum value. This value instructs Dapper Extensions to not generate a key before database insertion. Furthermore, Dapper Extensions will not obtain a key from the database after insertion. In other words, it is up to the developer to supply a key.