Hi, we're starting our work to migrate a k13 website to Experience.
We're pretty early on and I'm currently working on migrating our page types to test page migration.
On v13, we had a page type "BasePage". it was holding a few technical fields like should this page be on the site map, SEO, ... Those kind of things. After some research, we're trying to customize the migration tool to create a reusable field schema for it and map it to our page types.
Here is our schema/registration file:
public static IServiceCollection MigratePageTypes(this IServiceCollection serviceCollection)
{
var schemaBuilder = BuildBasePageSchema();
serviceCollection.AddSingleton<IReusableSchemaBuilder>(schemaBuilder);
serviceCollection.AddSingleton<IClassMapping>(BuildArticlePressRoomMapping());
// more of the same for each type...
serviceCollection.AddSingleton<IClassMapping>(BuildUnsubscribeMapping());
return serviceCollection;
}
private static ReusableSchemaBuilder BuildBasePageSchema()
{
var schemaBuilder = new ReusableSchemaBuilder(TargetClassNameBasePage, TargetDisplayNameSchema,"");
schemaBuilder.ConvertFrom(SourceClassNameBasePage, x => x switch
{
SourceFieldNameBasePageIsSiteMap => TargetFieldNameBasePageIsSiteMap,
SourceFieldNameBasePageDocumentPageTitle => TargetFieldNameBasePageDocumentPageTitle,
SourceFieldNameBasePageDocumentPageDescription => TargetFieldNameBasePageDocumentPageDescription,
_ => null
}
);
return schemaBuilder;
}
Generates the schema all right (missing fields tho...)
I'm having a little problem with page with only reusable fields.
They simply all crash with this message:
is missing dependency ClassInheritsFromClassID=5531 of type DataClassInfo
I'm guessing it's the fact that we don't have any fields to map the old and new table that cause this problem. Here is an example:
public static partial class PageTypeMapper
{
private const string SourceClassNameBus = $"{SourceClassNameRoot}.Bus";
private const string TargetBusBaseName = "Bus";
private const string TargetClassNameBus = $"{TargetClassNameRoot}.{TargetBusBaseName}";
private const string TargetTableNameBus = $"{TargetClassNameRoot}_{TargetBusBaseName}";
private static MultiClassMapping BuildBusMapping()
{
var mapping = new MultiClassMapping(TargetClassNameBus, target =>
{
target.ClassName = TargetClassNameBus;
target.ClassTableName = TargetTableNameBus;
target.ClassDisplayName= TargetBusBaseName;
target.ClassType = ClassType.CONTENT_TYPE;
target.ClassContentTypeType = ClassContentTypeType.WEBSITE;
target.ClassWebPageHasUrl = true;
});
mapping.BuildField($"{TargetBusBaseName}ID")
.AsPrimaryKey();
mapping.UseResusableSchema(TargetClassNameBasePage);
return mapping;
}
}
How can I map those types ?
On a parallel subject, I would have put the "IsTemplate" in SetFrom at true by default... Took me so much time to find it and I'm guessing most migration field are template fields :D
That's it. Thanks in advance and may you all have a great day :)