using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
namespace Umbraco.Core.Migrations
{
///
/// Implements .
///
internal class MigrationContext : IMigrationContext
{
///
/// Initializes a new instance of the class.
///
public MigrationContext(IUmbracoDatabase database, ILogger logger)
{
Database = database ?? throw new ArgumentNullException(nameof(database));
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
///
public ILogger Logger { get; }
///
public IUmbracoDatabase Database { get; }
///
public ISqlContext SqlContext => Database.SqlContext;
///
public int Index { get; set; }
///
public bool BuildingExpression { get; set; }
// this is only internally exposed
public List PostMigrations { get; } = new List();
///
public void AddPostMigration()
where TMigration : IMigration
{
// just adding - will be de-duplicated when executing
PostMigrations.Add(typeof(TMigration));
}
}
}