¿Cómo especificar un índice en Bag en Nhibernate?

I have NHibernate set up with Postgre database. I'm using mapping by code in combination with ConventionModelMapper.

NHibernate by default does not create indexes for foreign keys. For a simple column I can set foreign key using Index método en mi Property mapping. However there is no such methodfor Bag cartografía.

Will I have to define Inverse relationships to define indexes?

preguntado el 31 de julio de 12 a las 11:07

1 Respuestas

you have to define on which column of the bag mapping you want the index. It is most probably the KeyColumn

Bag(x => x.Collection, m => 
{
    m.Key(key => key.Column(c =>
    {
        c.Index("fooindex");
        c.Name("parent_id");
    }))
});

Respondido 31 Jul 12, 12:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.