Contentstack .NET Sample Entry Model

What follows is my attempt to define an Entry Model class as described in the blog post https://deliverystack.wordpress.com/2020/07/20/net-core-headless-cms-entry-models-and-entry-model-classes/ to support the Content Type that I described in the blog post at https://deliverystack.wordpress.com/2020/07/21/entry-data-formats-in-headless-cms/ for the Contentstack SaaS headless CMS.

Somehow I managed to name three fields incorrectly. I already published entries and pastebinned the JSON so I chose to attribute the model properties rather than changing the Field definitions. I don’t like using the vendor’s Asset class in my Entry Models so I replaced it with a custom class that exposes the URL of the Asset.

https://pastebin.com/inWWsdzq

Here is the output.

https://pastebin.com/f1TPWWZj

Potentially excluding access to Assets and Entries referenced by Entries of this Content Type, this Entry Model class could work with CMS from other vendors that support multiple values in individual Fields.

Actually, this example is too trivial because it does not describe how to handle Contentstack Modular Blocks (https://www.contentstack.com/docs/developers/create-content-types/modular-blocks/). I haven’t seen anything comparable to Modular Blocks in other CMS products, so modeling and implementing Modular Blocks will result in Entry Model classes that are specific to Contentstack data structures. As long as the Entry Models do not use the Contentstack .NET SDK directly, this is appropriate and really the only option other than parsing JSON by hand.

Published by John West

I like Twizzlers and um

2 thoughts on “Contentstack .NET Sample Entry Model

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: