Table of Contents

you are here (click to zoom) - discover the stack

Dynamic Entity Objects

Whenever you create a content-type - like Person - and want to work with the data in your C# Razor templates, you'll be working with a Dynamic Entity.

👉 also read about AsDynamic(...)

Code example using a Dynamic Entity

We'll assume we have a Content Type called Book with the following properties:

  • Title (text, 1-line)
  • Teaser (text, multi-line)
  • Description (text, html)
  • ReleaseDate (date)
  • Author (entity - another content item)

Here's a code example in a C# Razor template:

  The default variable for the current item is Content, 
  we'll just use another name for this sample
  note that .Title is automatically provided, 
  because the content-type has the property title. 
<div>Author: @Content.Author.FullName</div>

So basically all properties of this book can be shown using [Object].[PropertyName] - for example Content.ReleaseDate.

👉 more about this on Dynamic Entity Properties

Working with unpublished/draft items

TODO: write something about how-to-check if published/unpublished, navigating it, etc. - or link to such a page

Discover More in the Razor Tutorials

We have an rich series of Razor tutorials. You should really check them out 👍.


  1. Introduced in 2sxc 01.00
  2. Changed to use interface IDynamicEntity in 6.x
  3. Draft/Published introduced in 2sxc 7.x
  4. Presentation introduced in 2sxc 7.x
  5. Modified introduced in 2sxc 8.x
  6. Implemented .net equality comparer in 2sxc 9.42
  7. Parents added in 2sxc 9.42
  8. Get added in 2sxc 9.42 and added to interface IDynamicEntity in 10.07
  9. Parents introduced in 2sxc 9.42, and added to interface IDynamicEntity in 10.07
  10. IsDemoItem property added in 2sxc 10.06
  11. Changed dynamic access to a property to return a DynamicEntity which is enumerable in 10.27