It is possible to add a convention this way that sets the associations with the Public Mapping API that was included in Entity Framework 6.1 To do that you have to implement the IStoreModelConvention interface in a similar way:
public class JunctionTableConvention : IStoreModelConvention<AssociationType>
{
public void Apply(AssociationType item, DbModel model)
{
var associations = model.ConceptualToStoreMapping.AssociationSetMappings;
foreach (var association in associations)
{
var associationSetEnds = association.AssociationSet.AssociationSetEnds;
association.StoreEntitySet.Table = String.Format("{0}_{1}",
GetTableName(associationSetEnds[0].EntitySet.ElementType),
GetTableName(associationSetEnds[1].EntitySet.ElementType));
}
}
private string GetTableName(EntityType type)
{
var result = Regex.Replace(type.Name, ".[A-Z]", m => m.Value[0] + "_" + m.Value[1]);
return result.ToLower();
}
}
And you have to include it in the OnModelCreating function of your DbContext implementation simply by adding it to the Conventions collection:
modelBuilder.Conventions.Add(new JunctionTableConvention());