Table of contents
BelongsToAttribute API Document
Maps a one to one association.
Quick Note
Please note that the 'blogid' foreign key lies on the 'Post' table.
Example
public class Post : ActiveRecordBase { ... [BelongsTo("blogid")] public Blog Blog { get { return _blog; } set { _blog = value; } }
Constructors
BelongsToAttribute()
Initializes a new instance of the Castle.ActiveRecord.BelongsToAttribute class.
BelongsToAttribute(String column)
Indicates the name of the column to be used on the association. Usually the name of the foreign key field on the underlying database.
| Parameter | Description |
|---|---|
| column | Missing documentation |
Properties
| Name | Type | Description |
|---|---|---|
| Type | Type | Defines the target type of the association. It's usually inferred from the property type. |
| Column | String | Defines the column used by association (usually a foreign key) |
| CompositeKeyColumns | String[] | Defines the Composite Key columns used by association (aka Natural Keys). |
| Cascade | CascadeEnum | Defines the cascading behavior of this association. |
| OuterJoin | OuterJoinEnum | Defines the outer join behavior of this association. |
| Update | Boolean | Set to false to ignore this association when updating entities of this ActiveRecord class. |
| Insert | Boolean | Set to false to ignore this association when inserting entities of this ActiveRecord class. |
| NotNull | Boolean | Indicates whether this association allows nulls or not. |
| Unique | Boolean | Indicates whether this association is unique. |
| 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. |