PrimaryKeyAttribute API Document
Indicates the property which is the primary key.
Example
public class Blog : ActiveRecordBase { ... [PrimaryKey(PrimaryKeyType.Native)] private int Id { get { return _id; } set { _id = value; } }
Constructors
PrimaryKeyAttribute()
Initializes a new instance of the Castle.ActiveRecord.PrimaryKeyAttribute class.
PrimaryKeyAttribute(PrimaryKeyType generator)
Initializes a new instance of the Castle.ActiveRecord.PrimaryKeyAttribute class.
| Parameter | Description |
|---|---|
| generator | The generator. |
PrimaryKeyAttribute(PrimaryKeyType generator, String column)
Initializes a new instance of the Castle.ActiveRecord.PrimaryKeyAttribute class.
| Parameter | Description |
|---|---|
| generator | The generator. |
| column | The column. |
Properties
| Name | Type | Description |
|---|---|---|
| Generator | PrimaryKeyType | Gets or sets the generator. |
| Column | String | Gets or sets the column name |
| UnsavedValue | String | Gets or sets the unsaved value. |
| SequenceName | String | Gets or sets the name of the sequence. |
| ColumnType | String | Gets or sets the type of the column. |
| Length | Int32 | Gets or sets the length of values in the column |
| Params | String | Comma separated value of parameters to the generator |
| 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. |