Contentstack Entry Model Base Class

The following base class for Entry Model classes can expose all the values that I could find that can appear in any Contentstack Entry that appeared as if they could be useful, even if Contentstack does not expose those values as Fields in the CMS UI (those values are more like…properties, which is basically the opposite of field and property definitions in .NET classes).

https://deliverystack.net/2020/07/20/net-core-headless-cms-entry-models-and-entry-model-classes/

You can use something like this as a base class for your Entry Models. For memory and CPU considerations around serialization, Entry Model Classes in general should not expose properties that the code does not need (in which case, investigate techniques in the vendor’s SDK to specify or exclude specific Fields from the JSON representation of an Entry).

This definitely reflects a vendor-specific JSON format and values available from a specific vendor. As it is basically just a flat list of Field Values (except for publishing details) in standard formats with no dependence on the SDK, I can accept it. To switch CMS, at a minimum I would probably need to add some JsonProperty attributes to these properties.

https://pastebin.com/j2DXJapy

See how this compares to the JSON:

https://pastebin.com/FJqAr6XL

Published by John West

I like Twizzlers and um

One thought on “Contentstack Entry Model Base Class

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: