Need help writing a convention for indexing many-to-many tables

Original Post Todd Menier's Avatar

Todd Menier

01 Jun, 2010 03:20 PM via web

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!

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What is five times five?

      Recent Discussions

      05 Jul, 2010 10:29 PM
      05 Jul, 2010 12:45 PM
      05 Jul, 2010 12:42 PM
      05 Jul, 2010 12:17 PM
      05 Jul, 2010 12:12 PM

       

      03 Jul, 2010 12:26 AM
      02 Jul, 2010 02:17 PM
      02 Jul, 2010 08:18 AM
      02 Jul, 2010 12:20 AM
      01 Jul, 2010 10:14 PM