Home

Castle Stronghold

PropertyAttribute API Document

Maps a standard column of the table.

Example

In the following example, the column is also called 'name', so you don't have to specify.


public class Blog : ActiveRecordBase
{
    ...
    
    [Property]
    public int Name
    {
        get { return _name; }
        set { _name = value; }
    }

To map a column name, use


    [Property("blog_name")]
    public int Name
    {
        get { return _name; }
        set { _name = value; }
    }

Constructors

PropertyAttribute()

Initializes a new instance of the Castle.ActiveRecord.PropertyAttribute class.

PropertyAttribute(String column)

Initializes a new instance of the Castle.ActiveRecord.PropertyAttribute class.

ParameterDescription
column The column.

PropertyAttribute(String column, String type)

Initializes a new instance of the Castle.ActiveRecord.PropertyAttribute class.

ParameterDescription
column The column.
type The type.

Properties

NameTypeDescription
NotNullBoolean Gets or sets a value indicating whether this property allow null.
LengthInt32 Gets or sets the length of the property (for strings - nvarchar(50) )
ColumnString Gets or sets the column name
UpdateBoolean Set to false to ignore this property when updating entities of this ActiveRecord class.
InsertBoolean Set to false to ignore this property when inserting entities of this ActiveRecord class.
UniqueBoolean Gets or sets a value indicating whether this Castle.ActiveRecord.PropertyAttribute is unique.
FormulaString Gets or sets the formula used to calculate this property
ColumnTypeString Gets or sets the type of the column.
UniqueKeyString From NHibernate documentation: A unique-key attribute can be used to group columns in a single unit key constraint.
IndexString From NHibernate documentation: specifies the name of a (multi-column) index
SqlTypeString From NHibernate documentation: overrides the default column type
CheckString From NHibernate documentation: create an SQL check constraint on either column or table
AccessPropertyAccess Gets or sets the access strategy for this property
CustomAccessString Gets or sets the custom access strategy
AccessStringString Gets the access strategy string for NHibernate's mapping.

Google
Search WWW Search castleproject.org