Updated some of the property editor API to ensure that when formatting data for persistence we have access to the pre-values as well since these might need to be used to format the persisted data. Completed the new property editor: Multiple text box and it is saving the data in a backwards compatible format. Changed the internal AsDictionary method of the pre value collection to be a public method called FormatAsDictionary.

This commit is contained in:
Shannon
2013-08-28 17:53:31 +10:00
parent bec36fd91b
commit 0ebe9ec0fa
31 changed files with 390 additions and 138 deletions

View File

@@ -62,16 +62,20 @@ namespace Umbraco.Core.Models
_preValuesAsDictionary = preVals;
}
internal static IDictionary<string, PreValue> AsDictionary(PreValueCollection persistedPreVals)
/// <summary>
/// Regardless of how the pre-values are stored this will return as a dictionary, it will convert an array based to a dictionary
/// </summary>
/// <returns></returns>
public IDictionary<string, PreValue> FormatAsDictionary()
{
if (persistedPreVals.IsDictionaryBased)
if (IsDictionaryBased)
{
return persistedPreVals.PreValuesAsDictionary;
return PreValuesAsDictionary;
}
//it's an array so need to format it, the alias will just be an iteration
var result = new Dictionary<string, PreValue>();
var asArray = persistedPreVals.PreValuesAsArray.ToArray();
var asArray = PreValuesAsArray.ToArray();
for (var i = 0; i < asArray.Length; i++)
{
result.Add(i.ToInvariantString(), asArray[i]);