Contentful logo

Contentful Community

Rich Text / Document model broken in .NET Core SDK?

I’m using the .NET Core SDK. Per the Rich Text tutorial, I’m trying to use the Document type to define fields in my models. When I use the Contentful client to get data and type it as my model, the Document.Content “nodes” are empty. I can confirm when using the REST API that the values are there.

Unless I misunderstand, this is because Document.Content is defined as List[IContent] (I can’t use the proper triangle brackets in this post), and IContent has no fields defined. If IContent is being made concrete by another class that defines node properties, I don’t see it when reviewing the code base.

Please advise if this a bug or if there’s something I’m missing.

Hi @cnse-cful

There are multiple types that implement IContent, but the interface is just a marker for some type that can be a part of a rich text content structure. If you want to use your own classes as part of a rich text structure you’d implement this interface on your own types as well.

Are you using a content type resolver?

Have you tried setting ResolveEntriesSelectively = true on your ContentfulClient before making the call?

It’s working per https://www.contentful.com/developers/docs/net/tutorials/rich-text/

I truly can’t tell at this point why it wasn’t working, but it is now.

Thanks for the help.

1 Like