How to use LookInAssemblyOfType<T>() of MigratiotionLocator

Issue #6 resolved
Stepan Goremykin created an issue

Hi! Could you provide example how to use LookInAssemblyOfType?
I am using MongoDBMigrations 2.0 Nuget Package

Comments (7)

  1. Arthur Osmokiesku repo owner

    Hello @Stepan Goremykin ,
    Due to the method, ` LookInAssemblyOfType` became deprecated, you should use the method UseAssemblyOfType in brand new Fluent API instead.
    E.g.

    new MigrationEngine().UseDatabase(connectionString, databaseName)
        .UseAssemblyOfType<T>() // or its overload UseAssemblyOfType(Type type) or method UseAssembly(Assembly assembly) 
        .UseSchemeValidation(false) //or true if it needed.
        .Run(); // to update to the latest available version, or specify the target version in the argument.
    

    Thanks for your interest in my package. I’ll update the documentation to make this moment more clear.
    Don’t hesitate to ask me, if you have more questions.

  2. Stepan Goremykin reporter

    @Arthur Osmokiesku , Thanks for answer! I think we need to change README.md 🙂
    And could you explain UseSchemeValidation option? When I pass true flag there, I get an exception about optional parameter path

  3. Arthur Osmokiesku repo owner

    This function might be useful if you want to keep the same structure of all documents within a collection. This method analyzes the source code of migrations that will be applied to the database, grabs the list of collections that will be affected during the migration, and checks that documents have a consistent structure. If collection with inconsistent document structure found the exception will be raised. Currently, this feature doesn’t cover all possible cases and will be improved and a bit reworked in the nearest update.

  4. Log in to comment