private static ODataProperty ReadStringPropertyUnderServerKnob(string payload) { MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(payload)); ODataMessageReaderSettings settings = new ODataMessageReaderSettings(); settings.EnableODataServerBehavior(); ODataAtomInputContext context = new ODataAtomInputContext(ODataFormat.Atom, memoryStream, Encoding.UTF8, settings, false /*readingResponse*/, true /*sync*/, EdmModel, null); var deserializer = new ODataAtomPropertyAndValueDeserializer(context); return deserializer.ReadTopLevelProperty(StringProperty, StringProperty.Type); }
/// <summary> /// This method creates and reads the property from the input and /// returns an <see cref="ODataProperty"/> representing the read property. /// </summary> /// <param name="property">The <see cref="IEdmProperty"/> producing the property to be read.</param> /// <param name="expectedPropertyTypeReference">The expected type reference of the property to read.</param> /// <returns>An <see cref="ODataProperty"/> representing the read property.</returns> private ODataProperty ReadPropertyImplementation(IEdmStructuralProperty property, IEdmTypeReference expectedPropertyTypeReference) { ODataAtomPropertyAndValueDeserializer atomPropertyAndValueDeserializer = new ODataAtomPropertyAndValueDeserializer(this); return(atomPropertyAndValueDeserializer.ReadTopLevelProperty(property, expectedPropertyTypeReference)); }
/// <summary> /// This method creates and reads the property from the input and /// returns an <see cref="ODataProperty"/> representing the read property. /// </summary> /// <param name="property">The <see cref="IEdmProperty"/> producing the property to be read.</param> /// <param name="expectedPropertyTypeReference">The expected type reference of the property to read.</param> /// <returns>An <see cref="ODataProperty"/> representing the read property.</returns> private ODataProperty ReadPropertyImplementation(IEdmStructuralProperty property, IEdmTypeReference expectedPropertyTypeReference) { ODataAtomPropertyAndValueDeserializer atomPropertyAndValueDeserializer = new ODataAtomPropertyAndValueDeserializer(this); return atomPropertyAndValueDeserializer.ReadTopLevelProperty(property, expectedPropertyTypeReference); }