AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Attribute: [PropertyLength]

Posted by Gerhard Stephan on July 11th, 2006

The PropertyLength attribute is used to specify the length of a database column.

Setting this attribute has no effect on how the ObjectMapper .NET will handle this property, but it defines the length of a database column and therefore it affects the DDL creation.

Look at this example:


            public string FirstName


                  get { return _firstName; }

                  set { _firstName = value; }



Furthermore it has an effect on which data type the database column will have. Dependent on the database system you’re using, strings can only be stored up to a specific length of e.g. Oracle 4000 characters. If you want to store longer strings you have to choose other data types that can handle unlimited string size, e.g. CLOBS in Oracle or MEMO fields for Micorosoft Access.

To force the ObjectMapper .NET to use such data types, you have to set the attribute PropertyLength to int.MaxValue.


            public string Text


                  get { return text; }

                  set { text = value; }



This example will force the ObjectMapper .NET to use data types like CLOB (Oracle), MEMO (Microsoft Access) or TEXT (Microsoft SQL Server).


One Response to “Attribute: [PropertyLength]”

  1. AdFactum ObjectMapper .NET Blog » Blog Archive » Supported Data Types Says:

    […] {0} = Replacement for the column length specified by the attribute PropertyLength. (No Ratings Yet)  Loading … […]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>