MetaStringDictionary property from code

Vote:
 

I am creating a site with EPiServer Commerce 7.5 and I want to declare my variation metaclass from code.

Everything works fine except I have two fields that is of the StringDictionary in Commerce.

How do i declare those properties and decorate them so that they are interpreted as the type stringdictionary?

As of i now i have only done this:

[Display(Name = "OffersText")]
public virtual MetaStringDictionary OffersText { get; set; }

But I get the following error:

The type Mediachase.MetaDataPlus.MetaStringDictionary can not be mapped to a MetaDataType

I have also tried wth the type StringDictionary but i get the following error.

#85852
May 07, 2014 10:50
Vote:
 

Hi,

In 7.5, the dictionary types are not supported by Catalog contents. You need to update to latest nuget package (7.7.2 or later) to enable the support.

Regards.

/Q

#85886
May 08, 2014 7:16
Vote:
 

Thanks for replying.

I have updated project through nuget and it is still not working. Is it sufficient just declaring the property like above, or do I need to decorate the property with a specific attribute?

I have version 7.7.2.24 of Mediachase.

#85891
May 08, 2014 9:18
Vote:
 

I'm sorry to read it too fast. The dictionary types we're supporting are Single and Multi dictionary. The StringDictionary, as it has some special characteristics, will not be supported for now - You'll need to edit it via CM.

Thank you.

/Q

#85893
May 08, 2014 10:15
Vote:
 

Ok, so I will not be able to handle the string dictionary as Content. The reason is that I am writing an import job, that creates variantions and add them to the catalog. So basically I would need to either change the datatype to a multivalue dictionary. Or handle the standard properties as content and then pull out the old trusted MetaHelper and edit them the same way as before.

#85895
May 08, 2014 10:25
Vote:
 

So how do you decorate the property for Single and Multi dictionary? Neither of following is working:

public virtual MetaDictionary SchoolType { get; set; }

public virtual DictionarySingleEditorDescriptor MySingleDictionaryProperty { get; set; }

Can't seem to find any info on what to use for the Dictionary properties?

I'm running Commerce 7.7.

/J

#112665
Nov 03, 2014 13:56
Vote:
 

Found it:

[BackingType(typeof(PropertyDictionarySingle))]
public virtual string MyTestDictionary { get; set; }

[BackingType(typeof(PropertyDictionaryMultiple))]
public virtual ItemCollection<string> MyTestMultiDictionary { get; set; }

/J

#112667
Nov 03, 2014 14:08
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.