ORM Basics: Adjusting SQL Data TypesLast Updated: 03/28/2018 Introduced in Version: 2.0 |
Using overrides to the
ORMField attribute, you can set what database type is used to store a field. For more information on writing ORM types see ORM Basics.
Here is an example showing how to override for a long text field. This field will become an nvarchar(max) field in SQL.
1 2 3 4 |
[ORMField(typeof(TextFieldConverter))] [DataMember] [WritableValue] public string Description { get; set; } |
Here is an example showing how to limit the text length of a field. This field will become an nvarchar(15) field in SQL.
1 2 3 4 |
[ORMField("phone_number", 15, typeof(FixedLengthStringFieldConverter))] [DataMember] [WritableValue] public string PhoneNumber { get; set; } |