Fluent NHibernate Automap does not take into account IList<T> collections as indexed

Posted by Francisco Lozano on Stack Overflow See other posts from Stack Overflow or by Francisco Lozano
Published on 2009-10-03T18:26:02Z Indexed on 2010/05/15 16:04 UTC
Read the original article Hit count: 447

I am using automap to map a domain model (simplified version):

public class AppUser : Entity
{
    [Required]
    public virtual string NickName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    public virtual string PassKey { get; set; }

    [Required]
    [DataType(DataType.EmailAddress)]
    public virtual string EmailAddress { get; set; }
    public virtual IList<PreferencesDescription> PreferencesDescriptions { get; set; }
}

public class PreferencesDescription : Entity
{
    public virtual AppUser AppUser { get; set; }
    public virtual string Content{ get; set; }
}

The PreferencesDescriptions collection is mapped as an IList, so is an indexed collection (when I require standard unindexed collections I use ICollection).

The fact is that fluent nhibernate's automap facilities map my domain model as an unindexed collection (so there's no "position" property in the DDL generated by SchemaExport).

¿How can I make it without having to override this very case - I mean, how can I make Fluent nhibernate's automap make always indexed collections for IList but not for ICollection

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate