Как добавить типы документов для использования во вложенном контенте в UJet - PullRequest
0 голосов
/ 14 сентября 2018

Это то, что у меня есть сейчас, это создает тип данных, но я не могу понять, как добавить типы документов для использования во вложенном контенте, который я использую Ujet Code First: https://ujet.readthedocs.io

[DataType(typeof(string), "Umbraco.NestedContent")]
public class NestedContent 
{

}

public class NestedContentDataTypeMapping : DataTypeDefinitionMapping
{
    protected override Type[] SupportedTypes => new[] { typeof(NestedContent),typeof(ContactViewModel)};

    public override IDataTypeDefinition GetMappedDefinition(Type fromType)
    {
        return !CanMapToDefinition(fromType) ? null : GetDefinition();
    }

    private static IDataTypeDefinition GetDefinition()
    {
        var definitions = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionByPropertyEditorAlias("Umbraco.NestedContent");

        return definitions.First(definition => definition.Name.Equals(typeof(NestedContent).Name));
    }
}

}

...