Search Results for

    Show / Hide Table of Contents
    View Source

    Class MigrationPlan

    Represents a migration plan.

    Inheritance
    object
    Namespace: Umbraco.Cms.Infrastructure.Migrations
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class MigrationPlan

    Constructors

    View Source

    MigrationPlan(string)

    Initializes a new instance of the MigrationPlan class.

    Declaration
    public MigrationPlan(string name)
    Parameters
    Type Name Description
    string name

    The name of the plan.

    Properties

    View Source

    FinalState

    Gets the final state.

    Declaration
    public string FinalState { get; }
    Property Value
    Type Description
    string
    View Source

    IgnoreCurrentState

    If set to true the plan executor will ignore any current state persisted and run the plan from its initial state to its end state.

    Declaration
    public virtual bool IgnoreCurrentState { get; }
    Property Value
    Type Description
    bool
    View Source

    InitialState

    Gets the initial state.

    Declaration
    public virtual string InitialState { get; }
    Property Value
    Type Description
    string
    Remarks

    The initial state is the state when the plan has never run. By default, it is the empty string, but plans may override it if they have other ways of determining where to start from.

    View Source

    Name

    Gets the name of the plan.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string
    View Source

    Transitions

    Gets the transitions.

    Declaration
    public IReadOnlyDictionary<string, MigrationPlan.Transition?> Transitions { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<string, MigrationPlan.Transition>

    Methods

    View Source

    CreateRandomState()

    Creates a random, unique state as a string in GUID format.

    Declaration
    public virtual string CreateRandomState()
    Returns
    Type Description
    string

    A string containing a randomly generated, unique GUID in braces and uppercase.

    View Source

    From(string?)

    Specifies the starting state for the migration plan, which determines where migrations begin execution.

    Declaration
    public MigrationPlan From(string? sourceState)
    Parameters
    Type Name Description
    string sourceState

    The starting state to set for the migration plan.

    Returns
    Type Description
    MigrationPlan

    The current MigrationPlan instance, allowing for method chaining.

    View Source

    Merge()

    Initiates the process of merging multiple migration branches into a single branch within the migration plan.

    Declaration
    public MergeBuilder Merge()
    Returns
    Type Description
    MergeBuilder

    A Umbraco.Cms.Infrastructure.Migrations.MigrationPlan.MergeBuilder instance used to configure and define the merge operation.

    View Source

    ThrowOnUnknownInitialState(string)

    Throws an exception when the specified initial state is unknown to the migration plan.

    Declaration
    public virtual void ThrowOnUnknownInitialState(string state)
    Parameters
    Type Name Description
    string state

    The initial state value that is not recognized by the migration plan.

    View Source

    To(Guid)

    Adds a transition to the specified target state through an empty migration.

    Declaration
    public MigrationPlan To(Guid targetState)
    Parameters
    Type Name Description
    Guid targetState

    The target state to transition to.

    Returns
    Type Description
    MigrationPlan

    The updated MigrationPlan instance.

    View Source

    To(Guid, Type)

    Adds a transition to a target state through the specified migration type.

    Declaration
    public MigrationPlan To(Guid targetState, Type migration)
    Parameters
    Type Name Description
    Guid targetState

    The target state to transition to.

    Type migration

    The type of migration to apply for the transition.

    Returns
    Type Description
    MigrationPlan

    The updated MigrationPlan instance.

    View Source

    To(string)

    Adds a transition to the specified target state using an empty (no-operation) migration.

    Declaration
    public MigrationPlan To(string targetState)
    Parameters
    Type Name Description
    string targetState

    The target state to transition to.

    Returns
    Type Description
    MigrationPlan

    The updated MigrationPlan instance.

    View Source

    To(string, Type?)

    Adds a transition to a target state through a migration.

    Declaration
    public MigrationPlan To(string targetState, Type? migration)
    Parameters
    Type Name Description
    string targetState

    The target state to transition to.

    Type migration

    The type of migration to apply during the transition. This should be a System.Type derived from MigrationBase, or null for no migration.

    Returns
    Type Description
    MigrationPlan

    The updated MigrationPlan instance.

    View Source

    ToWithClone(string, string, string)

    Adds transitions to a targetState by cloning the transition chain from startState up to (but not including) endState.

    Declaration
    public MigrationPlan ToWithClone(string startState, string endState, string targetState)
    Parameters
    Type Name Description
    string startState

    The initial state from which the transition chain will be cloned.

    string endState

    The state at which to stop cloning transitions (exclusive).

    string targetState

    The state to which the final cloned transition will point instead of endState.

    Returns
    Type Description
    MigrationPlan

    The current MigrationPlan instance with the added transitions.

    View Source

    ToWithReplace<TMigrationNew>(string, string)

    Adds a transition to a new target state using the specified migration, replacing a previous migration for the given state.

    Declaration
    public MigrationPlan ToWithReplace<TMigrationNew>(string recoverState, string targetState) where TMigrationNew : AsyncMigrationBase
    Parameters
    Type Name Description
    string recoverState

    The previous target state that can be recovered from directly.

    string targetState

    The new target state to transition to.

    Returns
    Type Description
    MigrationPlan

    The MigrationPlan instance with the updated transition.

    Type Parameters
    Name Description
    TMigrationNew

    The migration to apply to reach the new target state.

    View Source

    ToWithReplace<TMigrationNew, TMigrationRecover>(string, string)

    Adds a transition to a new target state through a migration, replacing a previous migration with a recovery migration for the old state.

    Declaration
    public MigrationPlan ToWithReplace<TMigrationNew, TMigrationRecover>(string recoverState, string targetState) where TMigrationNew : AsyncMigrationBase where TMigrationRecover : AsyncMigrationBase
    Parameters
    Type Name Description
    string recoverState

    The previous target state that should be recovered from using TMigrationRecover before transitioning to the new target state.

    string targetState

    The new target state to transition to.

    Returns
    Type Description
    MigrationPlan

    The current MigrationPlan instance, allowing for method chaining.

    Type Parameters
    Name Description
    TMigrationNew

    The migration to apply for the new target state.

    TMigrationRecover

    The migration to use to recover from the previous target state.

    View Source

    To<TMigration>(Guid)

    Declaration
    public MigrationPlan To<TMigration>(Guid targetState) where TMigration : AsyncMigrationBase
    Parameters
    Type Name Description
    Guid targetState
    Returns
    Type Description
    MigrationPlan
    Type Parameters
    Name Description
    TMigration
    View Source

    To<TMigration>(string)

    Adds a transition from the current state to the specified target state using the specified migration type.

    Declaration
    public MigrationPlan To<TMigration>(string targetState) where TMigration : AsyncMigrationBase
    Parameters
    Type Name Description
    string targetState

    The name of the target state to transition to.

    Returns
    Type Description
    MigrationPlan

    The current MigrationPlan instance, allowing for method chaining.

    Type Parameters
    Name Description
    TMigration

    The type of IMigration to execute for the transition.

    View Source

    Validate()

    Validates the plan.

    Declaration
    public void Validate()
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX