Try our conversational search powered by Generative AI!

[11.8.5] Storing a list of strings/StringDictionary alternative?


So, I'm in the process of upgradering a CMS+Commerce solution from 7.5 to 11.8.5.

The site uses a StringDictionary metafield, and this has been discussed at length throughout the years.

My question now is - what is the recommended way of storing a List on a catalog content type?

I had a look at, but that discussion is very old, so I was thinking there must be a better/simpler way today?

That code also crashes the CMS part of the site, with "Type '[...].StringDictionary' could not be mapped to a PropertyDefinitionType"...

Jul 05, 2018 13:42

if it's just a List<string>, it has native support by IList<T>, you don't even need StringDictionary for that 

Jul 05, 2018 14:52

So the way to go is:

  1. Delete the old StringDictionary metafield (losing all current values - not a big problem).
  2. Create an IList<string> property in the model class(es).
  3. Run the import to make sure the products and variations are configured properly again.


Thanks (again)! :)

Jul 05, 2018 15:05

It's worth noting that StringDictionary is not just a string list - it is a "dictionary", so you can define pair like <"hello","world">

Of course if you are using StringDictionary as just a string list then it'll work :) 

Jul 05, 2018 15:10

I just tried it, and I get an exception about List<string> "can not be mapped to a MetaDataType" :(

Jul 05, 2018 15:11

You probably need [BackingType(typeof(PropertyStringList))] attribute :)

Edited, Jul 05, 2018 15:13

Doh! :)

Cool, everything works now. I hope. Still haven't gotten to updating the importers, but at least nothing crashes so far :)

Thanks again for you help!!

Jul 05, 2018 16:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.