Class MigrationStep
Contains information about name changes in ContentType.
Inheritance
Namespace: EPiServer.DataAbstraction.Migration
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public abstract class MigrationStep : Object
Remarks
There is no versioning handling in a migration step. It is intended to be a very specific class for specific databases. It is safe to remove the migration step implementation after the changes described in it have been commited to the database.
Examples
An example showing how to rename both a content type as well as a property on that content type.
using EPiServer.DataAbstraction.Migration;
namespace CodeSamples
{
public class MigrationStepExample : MigrationStep
{
public override void AddChanges()
{
RenameContentType();
RenameProperty();
}
private void RenameContentType()
{
//The content type formerly known as "Velocipede" should hereby be known as "Bicycle".
ContentType("Bicycle")
.UsedToBeNamed("Velocipede");
}
private void RenameProperty()
{
ContentType("Bicycle") //On the content type "Bicycle"
.Property("PneumaticTire") //There is a property called "PneumaticTire"
.UsedToBeNamed("WoodenTire"); //That used to be called "WoodenTire"
}
}
}
Constructors
MigrationStep()
Initializes a new instance of the MigrationStep class.
Declaration
public MigrationStep()
Properties
Changes
Gets the changes for content types added in AddChanges().
Declaration
public virtual IEnumerable<ContentTypeChange> Changes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ContentTypeChange> |
Methods
AddChanges()
Override this method and use it to populate the MigrationStep.Changes list.
Declaration
public abstract void AddChanges()
Remarks
Use the ContentType(String) method to register changes.
Examples
An example showing how to rename both a content type as well as a property on that content type.
using EPiServer.DataAbstraction.Migration;
namespace CodeSamples
{
public class MigrationStepExample : MigrationStep
{
public override void AddChanges()
{
RenameContentType();
RenameProperty();
}
private void RenameContentType()
{
//The content type formerly known as "Velocipede" should hereby be known as "Bicycle".
ContentType("Bicycle")
.UsedToBeNamed("Velocipede");
}
private void RenameProperty()
{
ContentType("Bicycle") //On the content type "Bicycle"
.Property("PneumaticTire") //There is a property called "PneumaticTire"
.UsedToBeNamed("WoodenTire"); //That used to be called "WoodenTire"
}
}
}
ContentType(String)
Registers a change of a content type or returns an existing one.
Declaration
protected virtual ContentTypeChange ContentType(string contentTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentTypeName | Name of the content type. |
Returns
Type | Description |
---|---|
ContentTypeChange | The created or existing content type change. |