Ejemplo n.º 1
0
        public virtual void Up(IDriver driver, ILogger logger, ISchemaInfo schemaInfo)
        {
            driver.BeforeUp(Version);

            var methods = GetUpMethods(migration.GetType(), driver);
            try
            {
                methods.ForEach(method => method.Invoke(migration, new[] { NewRunner(method, driver) }));
            }
            catch (ArgumentException)
            {
                throw new MigrationContractException("[Up] methods must take a single Runner parameter as an argument.", type);
            }
            catch (TargetInvocationException ex)
            {
                Console.Out.WriteLine(ex.InnerException.Message);
                Console.Out.WriteLine(ex.InnerException.StackTrace);
                throw;
            }

            driver.AfterUp(Version);

            schemaInfo.InsertSchemaVersion(Version, type.Assembly.GetName().Name, type.FullName);
        }