Skip to content

The Type System

Simon Mourier edited this page Feb 19, 2020 · 1 revision

Some of CodeModeler design concepts are strongly typed. Those concepts are referred to Typed Objects Concepts:

  • Entity and View Properties

  • Method and Rule Parameters.

CodeModeler Types

CodeModeler type system is a composite one, because it must adapt to the underlying target type systems:

  • the .NET type based on the Common Language Runtime type system

  • the Persistence type based on .NET’s System.Data.DbType enumeration

  • the target producers’ Persistent type (SQL Server, MySQL, etc.)

Here is a summary of CodeModeler types and their equivalent types:

CodeModeler Type and alisases .NET Type Persistence Type
bool
boolean, bit
System.Boolean DbType.Boolean
byte System.Byte DbType.Byte
char System.Char DbType.Byte if “Is Persistence Unicode” is set to false
DbType.Int16 if “Is Persistence Unicode” is set to true
currency
money, cost, price
System.Decimal DbType.Currency
datetime
date, time
System.DateTime DbType.DateTime
double
real
System.Double DbType.Double
single
float
System.Single DbType.Single
object
any, anyvalue
System.Object DbType.Object
guid
uniqueidentifier
System.Guid DbType.Guid
decimal System.Decimal DbType.Decimal
sbyte System.SByte DbType.Sbyte
elapsedtime
timespan
System.TimeSpan DbType.DateTime
Int
int32, integer
System.Int32 DbType.Int32
long
int64
System.Int64 DbType.Int64
short
int16
System.Int16 DbType.Int16
uint
uint32
System.UInt32 DbType.UInt32
ulong
uint64
System.UInt64 DbType.UInt64
ushort
uint16
System.UInt16 DbType.UInt16
byte System.Byte DbType.Byte
xml System.String DbType.AnsiString if “Is Persistence Unicode” is set to false
DbType.String if “Is Persistence Unicode” is set to true
Note: some persistence producers may handle this type specifically.
string
text
System.String DbType.AnsiString if “Is Persistence Unicode” is set to false
DbType.String if “Is Persistence Unicode” is set to true
email
mail
System.String DbType.AnsiString if “Is Persistence Unicode” is set to false
DbType.String if “Is Persistence Unicode” is set to true
password System.String DbType.AnsiString if “Is Persistence Unicode” is set to false
DbType.String if “Is Persistence Unicode” is set to true
url
hyperlink
System.String DbType.AnsiString if “Is Persistence Unicode” is set to false
DbType.String if “Is Persistence Unicode” is set to true
richstring
richtext
System.String DbType.AnsiString if “Is Persistence Unicode” is set to false
DbType.String if “Is Persistence Unicode” is set to true
data
byte[], binary
System.Byte[] DbType.Binary
file
attachment, document
CodeModeler Runtime provided DbType.Binary
blob
largebinary
CodeModeler Runtime provided DbType.Binary
film
video
CodeModeler Runtime provided DbType.Binary
image
picture, photo
CodeModeler Runtime provided DbType.Binary
audio
sound
CodeModeler Runtime provided DbType.Binary

Specific and Model Types

Beyond the types above, CodeModeler also supports .NET types and types defined in the model itself:

CodeModeler type .NET Type Persistence Type
Full .NET type name The specified type name DbType.Object
Model defined entity or entity collection The entity or collection .NET type name Depends on the relation implicitly defined
Model defined enumeration The generated Enum .NET type name The enumeration's DbType (DbType.Byte, DbType.SByte, DbType.Int16, DbType.UInt16, DbType.Int64, DbType.UInt64, DbType.UInt32, or DbType.Int32).
User Type The specified type name The specified persistence type

User Type

A UserType is a CodeModeler concept, just like entity, enumeration, property, etc. A user type has the following characteristics:

  • Name. This is how the user type is referenced.

  • Type Name: The user type’s type name. It must be another CodeModeler type name this user type “derives from”.

  • Other persistence related properties (“DbType”, “Is Nullable”, “Default Value”, etc.).

  • A list of rules.

Note: a UserType can be also used to override another type. You must name the user type with the same name as the type you want to override.

Clone this wiki locally