Where to convert data for new property editor when replacing another?
Hi there,
If I create a new property editor that should be allowed to replace an existing one, where should I handle the conversion of the old PE's data?
E.g. if the exisiting editor is a TextString but the new one stores JSON - If I replace the existing datatype, my new PE likely chokes on the existing "simpler" string data...
Is it enough to have the JS controller detect this somehow, or do I need to do something else at C# level too?
Doing it in a js controller "fixes" it for current content, but your published and non edited content still holds the "old" storage value... unless you have a property value converter that takes care of converting both old and new value to an object
Could also use the editor model events that takes the model that is being sent to the editor, and do the conversion there (c# code). Again, same issue, other content not opened in editor yet (and not re-published) will still hold the "old" published value of that property
Doing a migration could help, as you could loop all content having this property and change the value from text string to JSON.. yet, you'd have to republish all content (not ideal either)
Or a property value converter which "examines" the format and creates the typed object from either the old or new value format (which is safe, but will leave you with some redundant/obsolete code as soon as all content has been published in the new format)
Our approach mainly depends on the number of content... if number is low, a single migration to change the content value and publish is an option, otherwise we'd go with a property value converter that examines and emits the typed object to the value you're expecting in front-end (in that case we assume we have high numbers of content and we also almost sure not all content is going to be "touched" and re-published.
Hadn't really considered the ramifications fully, I can see — for me, I guess I can live with handling it in the JS controller and letting the PropertyValueConverter pass the value through as long as it's just a simple string.
Where to convert data for new property editor when replacing another?
Hi there,
If I create a new property editor that should be allowed to replace an existing one, where should I handle the conversion of the old PE's data?
E.g. if the exisiting editor is a
TextString
but the new one stores JSON - If I replace the existing datatype, my new PE likely chokes on the existing "simpler" string data...Is it enough to have the JS controller detect this somehow, or do I need to do something else at C# level too?
/Chriztian
Doing it in a js controller "fixes" it for current content, but your published and non edited content still holds the "old" storage value... unless you have a property value converter that takes care of converting both old and new value to an object
Could also use the editor model events that takes the model that is being sent to the editor, and do the conversion there (c# code). Again, same issue, other content not opened in editor yet (and not re-published) will still hold the "old" published value of that property
Doing a migration could help, as you could loop all content having this property and change the value from text string to JSON.. yet, you'd have to republish all content (not ideal either)
Or a property value converter which "examines" the format and creates the typed object from either the old or new value format (which is safe, but will leave you with some redundant/obsolete code as soon as all content has been published in the new format)
Our approach mainly depends on the number of content... if number is low, a single migration to change the content value and publish is an option, otherwise we'd go with a property value converter that examines and emits the typed object to the value you're expecting in front-end (in that case we assume we have high numbers of content and we also almost sure not all content is going to be "touched" and re-published.
-Dirk
Thanks Dirk!
Hadn't really considered the ramifications fully, I can see — for me, I guess I can live with handling it in the JS controller and letting the PropertyValueConverter pass the value through as long as it's just a simple string.
/Chriztian
is working on a reply...