sdk/dotnet/src/Microsoft.Datasync.Client/Query/OData/EdmTypeSupport.cs
/// <summary>
/// Converts an OData string back into the QueryNode.  This is used during OData filter parsing.
/// </summary>
/// <param name="literal">The value of the literal</param>
/// <param name="typestr">The type string.</param>
/// <returns>The <see cref="QueryNode"/> for the cast.</returns>
Converts an OData string back into the QueryNode.  This is used during OData filter parsing.
Converts an OData string back into the QueryNode . This is used during OData filter parsing .
public static QueryNode ToQueryNode(string literal, string typestr)
        {
            if (!EdmLookupTable.TryGetValue(typestr, out EdmType type))
            {
                throw new InvalidOperationException($"Edm Type '{typestr}' is not valid.");
            }
            var result = new ConstantNode(null);
            switch (type)
            {
                case EdmType.DateTime:
                    result.Value = DateTime.Parse(literal);
                    break;
                case EdmType.DateTimeOffset:
                    result.Value = DateTimeOffset.Parse(literal);
                    break;
                case EdmType.Guid:
                    result.Value = Guid.Parse(literal);
                    break;
            }
            return result;
        }
public static QueryNode ToQueryNode ( string literal , string typestr ) { if ( ! EdmLookupTable . TryGetValue ( typestr , out EdmType type ) ) { throw new InvalidOperationException ( $" Edm Type ' { typestr } ' is not valid. " ) ; } var result = new ConstantNode ( null ) ; switch ( type ) { case EdmType . DateTime : result . Value = DateTime . Parse ( literal ) ; break ; case EdmType . DateTimeOffset : result . Value = DateTimeOffset . Parse ( literal ) ; break ; case EdmType . Guid : result . Value = Guid . Parse ( literal ) ; break ; } return result ; }
Converts an OData string back into the QueryNode.
Converts an OData string back into the QueryNode .
The  for the cast.
The for the cast .
literal
string
The value of the literal
The value of the literal
typestr
string
The type string.
The type string .