Example #1
0
        static void MigrationsFuck()
        {
            Migrations miggy = Migrations.Instance;

            //the simple case
            miggy.RegisterMigration(new TestMigration()
            {
                SourceTypeVersionId = new Guid("00000000-5B32-4980-9B09-F6A28A52BF86"),
                TargetTypeVersionId = new Guid("90000000-5B32-4980-9B09-F6A28A52BF86")
            });
            //add an 'infinite loop' to migrations...
            miggy.RegisterMigration(new TestMigration()
            {
                SourceTypeVersionId = new Guid("10000000-5B32-4980-9B09-F6A28A52BF86"),
                TargetTypeVersionId = new Guid("00000000-5B32-4980-9B09-F6A28A52BF86")
            });
            miggy.RegisterMigration(new TestMigration()
            {
                SourceTypeVersionId = new Guid("00000000-5B32-4980-9B09-F6A28A52BF86"),
                TargetTypeVersionId = new Guid("10000000-5B32-4980-9B09-F6A28A52BF86")
            });
            miggy.RegisterMigration(new TestMigration()
            {
                SourceTypeVersionId = new Guid("10000000-5B32-4980-9B09-F6A28A52BF86"),
                TargetTypeVersionId = new Guid("20000000-5B32-4980-9B09-F6A28A52BF86")
            });
            miggy.RegisterMigration(new TestMigration()
            {
                SourceTypeVersionId = new Guid("20000000-5B32-4980-9B09-F6A28A52BF86"),
                TargetTypeVersionId = new Guid("30000000-5B32-4980-9B09-F6A28A52BF86")
            });
            miggy.RegisterMigration(new TestMigration()
            {
                SourceTypeVersionId = new Guid("30000000-5B32-4980-9B09-F6A28A52BF86"),
                TargetTypeVersionId = new Guid("40000000-5B32-4980-9B09-F6A28A52BF86")
            });


            var noPath = miggy.FindMigrationPath(
                new Guid("11000000-5B32-4980-9B09-F6A28A52BF86"),
                new Guid("30000000-5B32-4980-9B09-F6A28A52BF86"));

            var simplePath = miggy.FindMigrationPath(
                new Guid("00000000-5B32-4980-9B09-F6A28A52BF86"),
                new Guid("30000000-5B32-4980-9B09-F6A28A52BF86"));



            var noInfiniteLoopPath = miggy.FindMigrationPath(
                new Guid("00000000-5B32-4980-9B09-F6A28A52BF86"),
                new Guid("30000000-5B32-4980-9B09-F6A28A52BF86"));
        }