Blog Discussion: Page type code generation with Xperience by Kentico

Answers

Working with strongly typed page type classes in Xperience by Kentico has really become more streamlined thanks to the new .NET CLI code generation. Instead of dealing with TreeNode objects or manually copying generated classes from the admin portal, you can now generate all your page type classes straight from a terminal. The command is straightforward—just point it to the types you want, set the output location in your project, and it handles the rest. You can include or exclude objects based on patterns, skip confirmation prompts, and even customize namespaces. For developers migrating website or maintaining large projects, this makes keeping your models up to date much faster and less error-prone.

0

Good point Alia, always use strongly typed classes!

And showing just how flexible the Admin UI is: you can easily extend the listings by adding your own commands in the content types list, and create your own generate code option (if you have some trouble leaving the good old days of K13 and older with the copy/paste option)

When making changes to a contenttype, how nice would it be to simply hit a button?

It generates our classes in the configurable desired locations:

  "Project.XbyK.Core": {
    "CodeGenerator": {
      "ModelsProjectRelativeFolder": "..\\Project.Models",
      "ModelsProjectNamespace": "Project.Models"
    }
  },
2

To response this discussion, you have to login first.