Skip to content

Commit

Permalink
Add support for single matching input for Create method replacement o…
Browse files Browse the repository at this point in the history
…f type
  • Loading branch information
IsakNaslundBh authored and Fraser Greenroyd committed Jan 25, 2022
1 parent 787fa9c commit c031e46
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions BHoM_UI/Caller/Read.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ protected object OldCreateMethodToType(string json, List<ParamInfo> inputParams,
string key = parameter.Name.ToLower();
if (properties.ContainsKey(key) && parameter.DataType == properties[key].PropertyType)
parameter.Name = properties[key].Name;
else
{
List<PropertyInfo> typeProps = properties.Values.Where(x => x.PropertyType == parameter.DataType).ToList();
if(typeProps.Count == 1)
parameter.Name = typeProps[0].Name;
}

}

// Set the type item
Expand Down

0 comments on commit c031e46

Please sign in to comment.