So the call to .Index() in your example code is actually setting the "index"
attribute on the mapped column for the foreign key relationship. In a many
to many, its more complicated - there is more than one column involved.

Its not particularly nice, but you should be able to get it done with
something like this:

.ChildKeyColumns.Clear()
.ChildKeyColumns.Add("col1", c => c.Index("INDEX_BLAH"))

.ParentKeyColumns.Clear()
.ParentKeyColumns.Add( // etc)

You'll probably need to specify more than just the Index for the column. FNH
creates default columns for you but since you are clearing them (so you can
re add your own with an index) you will probably have to be more explicit
than you normally would.

It might turn out to be easier to just write a IColumnConvention that checks
for the appropriate columns and sets the index on them.

Paul.

On Wed, Aug 18, 2010 at 4:29 PM, Jan Limpens <j...@limpens.com> wrote:

> Yip, but on 1:n and 1:1 relations you can say
>
> References(x => x.Article, "ArticleID")
>
>                 .Not.Nullable()
>                 .ForeignKey("FK_ShoppingCartItem_Article")
>
>                 .Index("INDEX_ShoppingCartItem_ArticleId") <== !
>                 .Cascade.None()
>
>                 .Fetch.Join()
>                 .Access.CamelCaseField();
>
> but I have not found a way to do the same for m:n or monodirectional 1:n
> relations (With only a HasMany)
>
>
> On Wed, Aug 18, 2010 at 6:25 PM, James Gregory <jagregory....@gmail.com>wrote:
>
>> What do you mean by indexes? NHibernate doesn't create database indexes on
>> any of the columns it generates (if you're using SchemaExecute/Update).
>>
>> On Wed, Aug 18, 2010 at 10:23 PM, Jan Limpens <j...@limpens.com> wrote:
>>
>>> Hello,
>>>
>>> is there a possibility to create an index on both columns of the cross
>>> table between m:n mapped entities?
>>>
>>> --
>>> Jan
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Fluent NHibernate" group.
>>> To post to this group, send email to fluent-nhibern...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/fluent-nhibernate?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Fluent NHibernate" group.
>> To post to this group, send email to fluent-nhibern...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/fluent-nhibernate?hl=en.
>>
>
>
>
> --
> Jan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibern...@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to