MongoDatabaseStateChecker does not work if migration assembly is dynamically loaded
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)
-
repo owner -
repo owner - changed status to open
-
repo owner - changed status to resolved
Fixed bug
#8about migrations search in MongoDatabaseStateChecker→ <<cset 021dd9729260>>
-
reporter @Arthur Osmokiesku thank you for addressing this. looking forward to next nuget release :).
- Log in to comment
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.