Лучшее и, пожалуй, единственное надежное место для установки строки подключения - переопределение созданного oncontext.
Похоже, вы можете использовать частичный класс.Вот пример кода VB, который может помочь, я напишу его на C #, если это поможет
Это частичный класс с именем, совпадающим с вашим контекстом
Partial Public Class YourCtxContainer
Private Sub OnContextCreated()
' Register the handler for the SavingChanges event.
AddHandler Me.SavingChanges, AddressOf context_SavingChanges
End Sub
' SavingChanges event handler.
Private Shared Sub context_SavingChanges(ByVal sender As Object, ByVal e As EventArgs)
' Validate the state of each entity in the context before SaveChanges can succeed.
For Each entry As ObjectStateEntry In DirectCast(sender, ObjectContext).ObjectStateManager.GetObjectStateEntries(EntityState.Added)
If Not entry.IsRelationship Then
'Here check if the context connectionstring is what you want and if not.
'Create a new context for your inserts and updates and pass your entity over
'Then mark it handled so the current context dismisses it.
End If
Next
End Sub
Конечный класс