Table of contents
FieldAttribute 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 { [Field] string name;
Constructors
FieldAttribute()
Initializes a new instance of the Castle.ActiveRecord.FieldAttribute class.
FieldAttribute(String column)
Initializes a new instance of the Castle.ActiveRecord.FieldAttribute class.
| Parameter | Description |
|---|---|
| column | The column name. |
FieldAttribute(String column, String type)
Initializes a new instance of the Castle.ActiveRecord.FieldAttribute class.
| Parameter | Description |
|---|---|
| column | The column name |
| type | The column type. |
Properties
| Name | Type | Description |
|---|---|---|
| NotNull | Boolean | Gets or sets a value indicating whether the column allows null values |
| Length | Int32 | Gets or sets the length of this column. char(10), etc |
| Column | String | Gets or sets the column name |
| 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 |
| Update | Boolean | Set to false to ignore this field when updating entities of this ActiveRecord class. |
| Insert | Boolean | Set to false to ignore this field when inserting entities of this ActiveRecord class. |
| Unique | Boolean | Gets or sets a value indicating whether this Castle.ActiveRecord.FieldAttribute is unique. |
| Formula | String | Gets or sets the formula used to calculate this field |
| ColumnType | String | Gets or sets the type of the column. |
| 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. |