DXA's Generic Topic Entity Model (.NET)

The DefaultModelBuilder class maps Tridion Docs content to a Generic Topic Entity Model.

By default, DXA maps Topics published from Tridion Docs to the Generic Topic Entity Model. In a subsequent step, DXA transforms these generic models into Strongly Typed Topic Models.

The following .NET (C#) code sample shows how the DefaultModelBuilder class maps Tridion Docs content to a Generic Topic Entity Model:

[SemanticEntity("Topic")]
public class GenericTopic : EntityModel
{
        [SemanticProperty("topicTitle")]
        public string TopicTitle { get; set; }
 
        // Note: The TopicBody is XHTML which contains _all_ DITA properties (incl. title, body, related-links)
        [SemanticProperty("topicBody")]
        public string TopicBody { get; set; }
 
        public static void Register()
        {
            using (new Tracer())
            {
                ModelTypeRegistry.RegisterViewModel(new MvcData("Ish:Entity:Topic"), typeof(GenericTopic));
            }
        }
}

The first SemanticProperty maps the topicTitle field to the TopicTitle property. Similarly, the second SemanticProperty maps the topicBody field to the TopicBody property. The topicBody field is XHTML that contains all DITA properties.

After creating the Generic Topic Models, a second model builder, the StronglyTypedTopicBuilder class, will transform them into Strongly Typed Topic Models.