Need help writing a convention for indexing many-to-many tables
Hi,
I'm trying to write a convention that create indexes on all foreign key columns by default. I'm able to achieve this for many-to-one situations but not many-to-many. I believe the problem is that IManyToManyCollectionInstance doesn't seem to have anything equivalent to the Index method found on IManyToOneInstance, IPropertyInstance, etc. Here's what I have so far:
public class ForeignKeyIndexConvention : IReferenceConvention, IHasManyToManyConvention
{
public void Apply(IManyToOneInstance instance) {
instance.Index("my_index_name");
}
public void Apply(IManyToManyCollectionInstance instance) {
// what to do here? no Index method on IManyToManyCollectionInstance
}
}
Can anyone provide any guidance or work-around? Thanks in advance!