HasManyAttribute API Document
Maps a one to many association.
Example
public class Blog : ActiveRecordBase { ... [HasMany(typeof(Post), RelationType.Bag, Key="Posts", Table="Posts", Column="blogid")] public IList Posts { get { return _posts; } set { _posts = value; } }
Constructors
HasManyAttribute()
Initializes a new instance of the Castle.ActiveRecord.HasManyAttribute class.
HasManyAttribute(Type mapType)
Initializes a new instance of the Castle.ActiveRecord.HasManyAttribute class.
| Parameter | Description |
|---|---|
| mapType | Type of the map. |
HasManyAttribute(Type mapType, String keyColumn, String table)
Initializes a new instance of the Castle.ActiveRecord.HasManyAttribute class.
| Parameter | Description |
|---|---|
| mapType | Type of items in this association |
| keyColumn | The key column. |
| table | The table. |
Properties
| Name | Type | Description |
|---|---|---|
| ColumnKey | String | Gets or sets the key column name. |
| CompositeKeyColumnKeys | String[] | Gets or sets the names of the column in composite key scenarios. |
| RelationType | RelationType | Gets or sets the type of the relation. |
| MapType | Type | Gets or sets the type of the map. |
| Table | String | Gets or sets the table for this relation |
| Schema | String | Gets or sets the schema for this relation (dbo., etc) |
| Lazy | Boolean | Gets or sets a value indicating whether this Castle.ActiveRecord.RelationAttribute is lazy. |
| Inverse | Boolean | Gets or sets a value indicating whether this Castle.ActiveRecord.RelationAttribute is inverse. |
| Cascade | ManyRelationCascadeEnum | Gets or sets the cascade options for this Castle.ActiveRecord.RelationAttribute |
| OrderBy | String | Gets or sets the order by clause for this relation |
| Where | String | Gets or sets the where clause for this relation |
| Sort | String | Only used with sets |
| Index | String | Only used with maps or list |
| IndexType | String | Only used with maps |
| Element | String | Use for simple types. |
| Cache | CacheEnum | Gets or sets the cache strategy to use for this property |
| 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. |