Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creation of a DbMigrator with an explicit DbContext instance #1153

Merged
merged 1 commit into from
Aug 17, 2019

Conversation

ajcvickers
Copy link
Member

This prevents migrations having to attempt to create connections from connection strings.

Fixes #522

This prevents migrations having to attempt to create connections from connection strings.

Fixes #522
@CZEMacLeod
Copy link

Really useful change - I can finally get rid of the following code from my MigrationDBInitializer class... 😃

Private Shared ReadOnly _createNewMigrator As Reflection.ConstructorInfo
Shared Sub New()
    _createNewMigrator = GetType(Entity.Migrations.DbMigrator).GetConstructor(Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance,
                                                                            Nothing,
                                                                            {GetType(Entity.Migrations.DbMigrationsConfiguration),
                                                                            GetType(DbContext)},
                                                                            Nothing)
End Sub
Protected Shared Function GetNewMigrator(ByVal configuration As Entity.Migrations.DbMigrationsConfiguration,
                                            ByVal usersContext As DbContext) As Entity.Migrations.DbMigrator
    Return _createNewMigrator.Invoke({configuration, usersContext})
End Function

@ajcvickers ajcvickers merged commit 9690d3c into release/6.3 Aug 17, 2019
@ghost ghost deleted the ThatSheepIsntDolly0815 branch August 17, 2019 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DbMigrator should avoid connecting to master and should use existing connection if possible
3 participants