MongoDatabaseStateChecker does not work if migration assembly is dynamically loaded

Issue #8 resolved
Alex Strigelskiy created an issue

IsDatabaseOutdated looks up the stackframes assembly to reflect and find classes that implement IMigration. However, if the caller assembly does not have IMigration classes, but instead have these classes linked dynamically by using Assembly.LoadFrom("xxx.dll"), then MongoDatabaseStateChecker.IsDatabaseOutdated throws an exception.

MigrationEngine class allows setting assembly to reflect on using SetAssembly method. Similar functionality (SetAssembly) would be good for MongoDatabaseStateChecker. Alternatively IsDatabaseOutdated method could be implemented in the MigrationEngine itself.

The rational: caller wants to determine what version of the schema is applied and log it prior to doing the migration.

Comments (4)

  1. Arthur Osmokiesku repo owner

    Hi, @{557058:fb5af5b8-dc6e-41a8-aa3d-f05a13b9294b} Thank you for your attention and for creating this bug ticket. Good catch, by the way. I am preparing a new release that will be published soon. So hopefully this issue will be fixed in this update.

  2. Alex Strigelskiy reporter

    @Arthur Osmokiesku thank you for addressing this. looking forward to next nuget release :).

  3. Log in to comment