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.
| Parameter | Description |
|---|---|
| column | The column. |
PropertyAttribute(String column, String type)
Initializes a new instance of the Castle.ActiveRecord.PropertyAttribute class.
| Parameter | Description |
|---|---|
| column | The column. |
| type | The type. |
Properties
| Name | Type | Description |
|---|---|---|
| NotNull | Boolean | Gets or sets a value indicating whether this property allow null. |
| Length | Int32 | Gets or sets the length of the property (for strings - nvarchar(50) ) |
| Column | String | Gets or sets the column name |
| Update | Boolean | Set to false to ignore this property when updating entities of this ActiveRecord class. |
| Insert | Boolean | Set to false to ignore this property when inserting entities of this ActiveRecord class. |
| Unique | Boolean | Gets or sets a value indicating whether this Castle.ActiveRecord.PropertyAttribute is unique. |
| Formula | String | Gets or sets the formula used to calculate this property |
| ColumnType | String | Gets or sets the type of the column. |
| UniqueKey | String | From NHibernate documentation: A unique-key attribute can be used to group columns in a single unit key constraint. |
| Index | String | From NHibernate documentation: specifies the name of a (multi-column) index |
| SqlType | String | From NHibernate documentation: overrides the default column type |
| Check | String | From NHibernate documentation: create an SQL check constraint on either column or table |
| Access | PropertyAccess | Gets or sets the access strategy for this property |
| CustomAccess | String | Gets or sets the custom access strategy |
| AccessString | String | Gets the access strategy string for NHibernate's mapping. |