Convention for Index creation
Question: I understand the reasoning for not automatically creating
indexes on Foreign Keys, but if I WANT Foreign Keys to have their
Indexes automatically generated at SchemaExport or SchemaUpdate time,
is there a way to do that (Specifically for HasMany and HasManyToMany
relations)?
I've been looking for a way to do this by convention, as in my
specific case I would want this to happen at all times...
I saw this:
http://stackoverflow.com/questions/607935/generate-table-indexes-usin...
http://stackoverflow.com/questions/1786898/fluent-nhibernate-and-sche...
One of those could do it, but I'm looking for a way to do it by
convention instead of either attribute decoration on the property or
specified inline on the mappings files.
Also, I'm not sure if the first way (attribute) would work for a
HasManyToMany or HasMany.
I've already gone through and MANUALLY added all these indexes, but
this is more for my library of conventions for our future development
projects...
Support Staff 2 Posted by James Gregory on 05 Nov, 2010 01:26 PM
How have you manually added the indexes? Have you tried doing the same through an
IHasManyConvention
?3 Posted by Michael Hallock on 05 Nov, 2010 06:34 PM
Well, manually created as in go into SQL server and manually add them all to the columns they should be on... :-)
I was just looking for a way to do this on green field projects automagically in the future.