Home > Developing Using CodeFluent Entities, Presentation > CodeFluent Entities Type System

CodeFluent Entities Type System


CodeFluent Entities models are platform independent. Code generation isn’t template-based, instead, CodeFluent Entities infers a meta-model from your designed model and producers will then translate this inferred in-memory representation into actual code.

Regarding types, the process is basically as follows: from the type you defined in your model, CodeFluent Entities in its meta-model will infer a three types being:

  • a CLR type,
  • a Persistence type (i.e. a System.Data.DbType),
  • and a UI type.

Producers will then use those inferred types. For instance the Business Object Model producer will use the CLR type in the generated .NET Business Object Model (a.k.a. BOM), and persistence producers use the persistence type to translate it in their target platform.

image

 

Note: In your models you can also use platform specific code, such as explicitly defining that a column should be of a specific type.

CodeFluent Entities provides an extensive type system allowing you to design more or less anything. Here’s a list of the currently supported type system:

CodeFluent types & aliases CLR types Persistence types UI types
bool (boolean, bit) System.Boolean DbType.Boolean Boolean
byte System.Byte DbType.Byte Integer
char System.Char DbType.Byte if persistenceUnicode is set to false Character
currency (money, cost, price) System.Decimal DbType.Currency Currency
datetime (date, time) System.DateTime DbType.DateTime DateTime
double (real) System.Double DbType.Double Double
single (float) System.Single DbType.Single Single
object (any, anyvalue) System.Object DbType.Object AnyValue
guid (uniqueidentifier) System.Guid DbType.Guid UniqueIdentifier
decimal System.Decimal DbType.Decimal Number
sbyte System.SByte DbType.Sbyte Integer
elapsedtime (timespan) System.TimeSpan DbType.DateTime ElapsedTime
int (int32, integer) System.Int32 DbType.Int32 Integer
long (int64) System.Int64 DbType.Int64 Integer
short (int16) System.Int16 DbType.Int16 Integer
uint (uint32) System.UInt32 DbType.UInt32 Integer
ulong (uint64) System.UInt64 DbType.UInt64 Integer
ushort (uint16) System.UInt16 DbType.UInt16 Integer
byte System.Byte DbType.Byte Integer
xml System.String DbType.AnsiString if persistenceUnicode is set to false Xml
string (text) System.String DbType.AnsiString if persistenceUnicode is set to false Text
email (mail) System.String DbType.AnsiString if persistenceUnicode is set to false Email
password System.String DbType.AnsiString if persistenceUnicode is set to false Password
url (hyperlink) System.String DbType.AnsiString if persistenceUnicode is set to false HyperLink
richstring (richtext) System.String DbType.AnsiString if persistenceUnicode is set to false RichText
data (byte[], binary) System.Byte[] DbType.Binary Binary
file (attachment, document) CodeFluent Runtime provided DbType.Binary File
blob (largebinary) CodeFluent Runtime provided DbType.Binary BinaryLarge
film (video) CodeFluent Runtime provided DbType.Binary Video
image (picture, photo) CodeFluent Runtime provided DbType.Binary Image
audio (sound) CodeFluent Runtime provided DbType.Binary Audio

In the end those types will be translated into their target platform equivalent.

For instance, here’s how types are translated in the persistence layer:

Persistent Type SQL Server 2000/2005 SQL Server 2008 Oracle Database
DbType.Boolean bit bit NUMBER
DbType.Byte | DbType.Sbyte tinyint tinyint NUMBER
DbType.Currency money money NUMBER
DbType.DateTime datetime date DATE
DbType.Time datetime time TIMESTAMP
DbType.Date datetime date DATE
DbType.Decimal decimal decimal NUMBER
DbType.Double float float BINARY_DOUBLE
DbType.Guid uniqueidentifier uniqueidentifier RAW
DbType.UInt16 | DbType.Int16 smallint smallint NUMBER
DbType.UInt32 | DbType.Int32 int int NUMBER
DbType.UInt64 | DbType.Int64  bigint time NUMBER
DbType.Object sql_variant sql_variant BLOB
DbType.Single real real BINARY_FLOAT
DbType.AnsiString | DbType.AnsiStringFixedLength varchar | text varchar | text VARCHAR2 | CLOB
DbType.String | DbType.StringFixedLength nvarchar | ntext nvarchar | ntext NVARCHAR2 | NCLOB
DbType.Binary image | varbinary image | varbinary BLOB |RAW

Note: unknown model types are serialized and the serialization used can be configured.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s