Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 524 Bytes

Enum-support.md

File metadata and controls

20 lines (16 loc) · 524 Bytes

Enum support

By default enums are represented as integer values.

type PostStatus = 
     | New = 0
     | Published = 1
     | Archived = 2

If you prefer more descriptive values in a database, you can override them using EnumValueAttribute:

type PostStatus = 
     | [<EnumValue("N")>] New = 0
     | [<EnumValue("P")>] Published = 1
     | [<EnumValue("A")>] Archived = 2

Arguments of EnumValueAttribute can be any values, that can be written do a database (integers, strings, etc.).