-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
In the below example, getting the values of the array ValueContainer type is abit bloated and requires one to explicite do GetValue<IList<ValueContainer>>(), using ValueContainer[] or Object[] would throw exceptions.
public override ValueTask<ValueContainer> ExecuteFunction(params ValueContainer[] parameters)
{
var relationship = parameters[0]?.ToString()?.ToLower();
var data = _formDataAccessor.Data;
if (data.ContainsKey(relationship))
{
var array = data[relationship];
if(array.Type() == ValueType.Array)
{
var arrayData = array.GetValue<IList<ValueContainer>>();
return new ValueTask<ValueContainer>(new ValueContainer(arrayData.Count > 0));
}
}
return new ValueTask<ValueContainer>(new ValueContainer(false));
}
consider ValueContainer to implement IEnumerable ? as short cuts to return properties for objects or items for arrays. Or just a better AsArray?
Metadata
Metadata
Assignees
Labels
No labels