Introducing a Widget extension method



Defining a widget content type in migrations always require the following parts and settings:

.WithSetting("Stereotype", "Widget");


So it may be nice to have an extension method to help with that:
public static class ContentTypeDefinitionBuilderExtensions {
    public static ContentTypeDefinitionBuilder Widget(this ContentTypeDefinitionBuilder builder) {
        return builder
            .WithSetting("Stereotype", "Widget");
Then defining a widget in a migration can look like this:

contentDefinitionManager.AlterTypeDefinition("MyWidget", type => type
            .DisplayedAs("My Widget")
Another idea is this: we have an AlterTypeDefinition() and AlterPartDefinition() method. Wouldn't it be nice if there were also an AlterWidgetDefinition()? Which could also be implemented as an extension method:

public static class ContentDefinitionManagerExtensions {
    public static void AlterWidgetDefinition(
        this IContentDefinitionManager contentDefinitionManager, 
        string name, 
        string displayName, 
        Action<ContentTypeDefinitionBuilder> alteration = null
        contentDefinitionManager.AlterTypeDefinition(name, type => { type

            if (alteration != null)
Note that it uses the .Widget() extension method mentioned earlier, and that it takes a lambda so the user can add more parts and fields and settings:

ContentDefinitionManager.AlterWidgetDefinition("FeaturedProductWidget", "Featured Product Widget", widget => widget.WithPart("BodyPart"));