Custom Property with custom value class


I have read but I can't see if I have problem with JSONConverter.

My Property:

public virtual ExternalDocument Document { get; set; }


My property:

public override object Value
                var value = base.Value as string;

                if (value == null)
                    return null;

                var identifier = GetIdentifier(value);
                var fileName = GetFileName(value);
                return new ExternalDocument {FileName = fileName, Identifier = identifier};
                if (value is ExternalDocument)
                    var ed = value as ExternalDocument;
                    base.Value = String.Format("{0} [{1}]", ed.FileName, ed.Identifier);
                    base.Value = value;


My editor wored fine until I added the backing type (it was storing string before). Do I have to do anything in my editor so that Value's set is called? Right now the autosave only calls get and I receive the following error:

Something went wrong

  • Error converting value "Meeting-15.pdf [23]" to type 'Models.Properties.ExternalDocument'. Path '', line 1, position 21. Could not cast or convert from System.String to Models.Properties.ExternalDocument.

In the Alloy sample site's StringList property the editor converts the string to an array before calling this.onChange(list).

In my editor I only calls onChange with the string, I thought that PropertyExternalDocument Value property could handle transition from string to object, but I may hav missunderstood this?

Feb 18, 2013 15:41

I got help from Linus Ekström, who pointed me to this blog post by Alexander Haneng which solved my problem:

Edited, Feb 18, 2013 18:58
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.