umbraco / Umbraco.Cms.Integrations

MIT License
36 stars 21 forks source link

Add extension method for handling lists and arrays. #187

Closed acoumb closed 5 months ago

acoumb commented 5 months ago

With this PR, I've tried to address an issue raised from the COMA team about the string representation returned from polling for document types properties (e.g. System.Collections.Generic.List`1[Umbraco.Core.Models.PublishedContent.IPublishedContent] or System.String[]).

My approach to this was to add an extension method for handling lists and arrays using reflection, without having to tightly couple the implementation with types from CMS. This way I could avoid introducing breaking changes and address all versions of the CMS (8+).

I was considering using a similar approach with Algolia, but I think, if I remember correctly, that PropertyEditorCollection was fully used with Examine with version 11 or 12 of the CMS, and am not sure if it will deliver the expected result on Umbraco 8.

acoumb commented 5 months ago

With the latest commit, I took the content value retrieval out of the static context of the extension methods and introduced a service for handling the data. Then, in the service, I am using a content factory to create custom parsers depending on the editor alias.