Available Data Types
The actual data types allowed with their corresponding SQL Server types, and types to signify "null" (note that .NET primitive types such as integers cannot be null, yet it is useful to be able to specify a number is null, meaning, for example, "not applicable") are shown below:
.NET Type
|
SQL Server Type
|
Null Value |
Notes
|
string |
nvarchar |
"" |
This is applicable to single-line strings. The length of the column is equal to the max length specified on the DBColumn. Note that Shunde cannot distinguish between null and an empty string.
|
string |
ntext |
"" |
When no maximum length is specified on the DBColumn it becomes an ntext column which can hold vast amounts of text.
|
bool
|
bit
|
n/a
|
There is no way to represent a null boolean in Shunde
|
short
|
smallint
|
DBColumn.ShortNullValue
|
|
int
|
int
|
DBColumn.IntNullValue
|
|
long
|
bigint
|
DBColumn.LongNullValue
|
|
float
|
float(24)
|
DBColumn.FloatNullValue
|
|
double
|
float(53) |
DBColumn.DoubleNullValue |
|
DateTime
|
DateTime
|
DBColumn.DateTimeNullValue
|
|
BinaryData
|
image
|
BinaryData.Exists == false
|
A Shunde.Framework.BinaryData structure contains an array of bytes, a mime type, and filename. Therefore, a single BinaryData field gets mapped to 3 columns in the database. |
DBObject
|
int
|
null
|
A class extending DBObject gets translated to the field name with "Id" appended to it, and it becomes a foreign key to the table of the type of object it is pointing to. The full .NET type is also recorded to identify the type of object without having to check in the DBObject table. For example, if "owner" is a field of type "MyNamespace.Person" in the "Car" table, then "ownerId" will point to the "id" column in the "Person" table, and "ownerClassName" will be "MyNamespace.Person". |
|