Esempio n. 1
0
        public void UseMigrations(IReadOnlyList <Migration> migrations)
        {
            Migrations = migrations.OrderBy(x => x.Version).Where((x, i) =>
            {
                var expectedVersion = i + 1;

                if (x.Version == expectedVersion)
                {
                    return(true);
                }

                throw new ArgumentException($"Missing migration for version {expectedVersion}.");
            }).ToList();

            ConfiguredVersion = Migrations.Any() ? Migrations.Last().Version : 0;
        }