in src/Readers/Vipr.Reader.OData.v4/ODataVocabularyReader.cs [344:379]
private static object MapListElements(IEdmDelayedValue delayedValue)
{
IEdmValue edmValue;
try
{
edmValue = delayedValue.Value;
return MapToClr(edmValue);
}
catch (ArgumentNullException)
{
// This is a painful hack to deal with the fact that parsing the navigation
// property returned a delayedValue that evaluates a NullException when you call .Value
// Attempt to obtain the inner expression because we don't have access to the type of the Delayed Collection
var innerExpression = delayedValue.GetPropertyByName<IEdmExpression>("Expression");
switch (innerExpression.ExpressionKind)
{
case EdmExpressionKind.NavigationPropertyPath:
{
IEdmPathExpression pe = innerExpression as IEdmPathExpression;
if (pe == null)
{
throw new ArgumentNullException("delayedValue",
"A IEdmExpression of delayedValue type NavigationPropertyPath was unable to be cast correctly to a IEdmNavigationPropertyPath");
}
// Map navigation properties to strings for convenience
return string.Join("/", pe.Path);
}
default:
throw new NotImplementedException(
string.Format("A custom mapping for ExpressionKind {0} has not yet been implemented.",
innerExpression.ExpressionKind));
}
}
}