AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Archive for July, 2007

Attribute: [DefaultValue]

Posted by Gerhard Stephan on 13th July 2007

The attribute [DefaultValue] can be used to specify a default value for a property. The [DefaultValue] attribute only affects the creation of the DDL file where a DEFAULT value is added to the field definition of the database.

        [PropertyLength(100)]

        [DefaultValue("Unkown Company")]

        public string LegalName

        {

            get { return legalName; }

            set { legalName = value; }

        }

The resulting field definition would be:

	LegalName VARCHAR(100) DEFAULT 'Unkown Company';

Posted in Attributes | No Comments »

New Release – AdFactum ObjectMapper .NET 1.80.1811.0

Posted by Gerhard Stephan on 11th July 2007

It’s time again to present a new release. As suggested in trouble ticket https://sourceforge.net/tracker/index.php?func=detail&aid=1744670&group_id=156554&atid=800253 the AdFactum ObjectMapper .NET does now support the attribute [DefaultValue]  to create DDL scripts that includes the specified default value.

As a second thing, a bug within the repository has been fixed. It occured when trying write the repository. If a table name with two or less characters exists, the AdFactum ObjectMapper .NET ended with an exception.

As a Last point, the update mechanism of character properties has been fixed. In prior versions character properties were all time being updated, although no data change has occured.

That’s all for now
Cheers

Gerhard

Posted in Releases | No Comments »

Supported Data Types

Posted by Gerhard Stephan on 4th July 2007

The AdFactum ObjectMapper .NET supports most Data Types that are available when using the Microsoft .NET Framework. For a better overview how data types are mapped against the different database types, the following tables shows the mapping details.

    Oracle
System.Boolean NUMBER(1,0) DEFAULT 0 NOT NULL
System.Byte NUMBER(3)
System.DateTime DATE
System.Decimal NUMBER(*,12)
System.Double FLOAT({0})
System.Guid RAW(16)
System.Int16 NUMBER(6)
System.Int32 INTEGER
System.Int64 INTEGER
System.Single FLOAT({0})
System.String VARCHAR2({0})
System.TimeSpan DATE
System.Enum NUMBER(4) DEFAULT -1 NOT NULL
System.IO.Stream BLOB
System.Byte[] BLOB
System.Char CHAR(1)
Special case for unlimited string length CLOB
Microsoft SQL Server
System.Boolean BIT DEFAULT 0 NOT NULL
System.Byte TINYINT
System.DateTime DATETIME
System.Decimal DECIMAL(28,12)
System.Double FLOAT
System.Guid UNIQUEIDENTIFIER
System.Int16 SMALLINT
System.Int32 INT
System.Int64 BIGINT
System.Single REAL
System.String VARCHAR({0})
System.TimeSpan BIGINT
System.Enum SMALLINT NOT NULL
System.IO.Stream IMAGE
System.Byte[] IMAGE
System.Char CHAR(1)
Special case for unlimited string length TEXT
Microsoft SQL Server CE
System.Boolean BIT DEFAULT 0 NOT NULL
System.Byte TINYINT
System.DateTime DATETIME
System.Decimal FLOAT
System.Double FLOAT
System.Guid UNIQUEIDENTIFIER
System.Int16 SMALLINT
System.Int32 INT
System.Int64 BIGINT
System.Single REAL
System.String NVARCHAR({0})
System.TimeSpan BIGINT
System.Enum SMALLINT NOT NULL
System.IO.Stream IMAGE
System.Byte[] IMAGE
System.Char NCHAR(1)
Special case for unlimited string length NTEXT
Microsoft Access
System.Boolean BIT DEFAULT 0 NOT NULL
System.Byte BYTE
System.DateTime DATETIME
System.Decimal DOUBLE
System.Double DOUBLE
System.Guid GUID
System.Int16 SMALLINT
System.Int32 INT
System.Int64 LONG
System.Single SINGLE
System.String VARCHAR({0})
System.TimeSpan DATETIME
System.Enum SMALLINT NOT NULL
System.IO.Stream IMAGE
System.Byte[] IMAGE
System.Char CHAR(1)
Special case for unlimited string length MEMO

 

{0} = Replacement for the column length specified by the attribute PropertyLength.

Posted in Hint | No Comments »