Home

Castle Stronghold

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.

ParameterDescription
mapType Type of the map.

HasManyAttribute(Type mapType, String keyColumn, String table)

Initializes a new instance of the Castle.ActiveRecord.HasManyAttribute class.

ParameterDescription
mapType Type of items in this association
keyColumn The key column.
table The table.

Properties

NameTypeDescription
ColumnKeyString Gets or sets the key column name.
CompositeKeyColumnKeysString[] Gets or sets the names of the column in composite key scenarios.
RelationTypeRelationType Gets or sets the type of the relation.
MapTypeType Gets or sets the type of the map.
TableString Gets or sets the table for this relation
SchemaString Gets or sets the schema for this relation (dbo., etc)
LazyBoolean Gets or sets a value indicating whether this Castle.ActiveRecord.RelationAttribute is lazy.
InverseBoolean Gets or sets a value indicating whether this Castle.ActiveRecord.RelationAttribute is inverse.
CascadeManyRelationCascadeEnum Gets or sets the cascade options for this Castle.ActiveRecord.RelationAttribute
OrderByString Gets or sets the order by clause for this relation
WhereString Gets or sets the where clause for this relation
SortString Only used with sets
IndexString Only used with maps or list
IndexTypeString Only used with maps
ElementString Use for simple types.
CacheCacheEnum Gets or sets the cache strategy to use for this property
AccessPropertyAccess Gets or sets the access strategy for this property
CustomAccessString Gets or sets the custom access strategy
AccessStringString Gets the access strategy string for NHibernate's mapping.

Google
Search WWW Search castleproject.org