本文整理汇总了C#中ODataMessageReader.ReadValue方法的典型用法代码示例。如果您正苦于以下问题:C# ODataMessageReader.ReadValue方法的具体用法?C# ODataMessageReader.ReadValue怎么用?C# ODataMessageReader.ReadValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODataMessageReader
的用法示例。
在下文中一共展示了ODataMessageReader.ReadValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadValueOfTypeDefinitionShouldWork
public void ReadValueOfTypeDefinitionShouldWork()
{
Stream stream = new MemoryStream(Encoding.Default.GetBytes("123"));
IODataResponseMessage responseMessage = new InMemoryMessage() { StatusCode = 200, Stream = stream };
ODataMessageReader reader = new ODataMessageReader(responseMessage, new ODataMessageReaderSettings(), new EdmModel());
reader.ReadValue(new EdmTypeDefinitionReference(new EdmTypeDefinition("NS", "Length", EdmPrimitiveTypeKind.Int32), true)).Should().Be(123);
}
示例2: ReadValueOfAbbreviativeDateShouldWork
public void ReadValueOfAbbreviativeDateShouldWork()
{
Stream stream = new MemoryStream(Encoding.Default.GetBytes("2014-1-3"));
IODataResponseMessage responseMessage = new InMemoryMessage() { StatusCode = 200, Stream = stream };
ODataMessageReader reader = new ODataMessageReader(responseMessage, new ODataMessageReaderSettings(), new EdmModel());
reader.ReadValue(new EdmTypeDefinitionReference(new EdmTypeDefinition("NS", "DateValue", EdmPrimitiveTypeKind.Date), true)).Should().Be(new Date(2014, 1, 3));
}
示例3: Read
public override object Read(ODataMessageReader messageReader, ODataDeserializerReadContext readContext)
{
if (messageReader == null)
{
throw Error.ArgumentNull("messageReader");
}
object value = messageReader.ReadValue(PrimitiveTypeReference);
// TODO: Bug 467612: do value conversions here.
return value;
}
示例4: ReadValueOfAbbreviativeTimeOfDayShouldWork
public void ReadValueOfAbbreviativeTimeOfDayShouldWork()
{
Stream stream = new MemoryStream(Encoding.Default.GetBytes("12:30:4.998"));
IODataResponseMessage responseMessage = new InMemoryMessage() { StatusCode = 200, Stream = stream };
ODataMessageReader reader = new ODataMessageReader(responseMessage, new ODataMessageReaderSettings(), new EdmModel());
reader.ReadValue(new EdmTypeDefinitionReference(new EdmTypeDefinition("NS", "TimeOfDayValue", EdmPrimitiveTypeKind.TimeOfDay), true)).Should().Be(new TimeOfDay(12, 30, 4, 998));
}
示例5: ReadFromMessageReader
protected override void ReadFromMessageReader(ODataMessageReader reader, IEdmTypeReference expectedType)
{
object obj2 = reader.ReadValue(expectedType);
ODataMaterializer.MaterializePrimitiveDataValue(base.ExpectedType, null, obj2, base.ResponseInfo, () => "TODO: Is this reachable?", out this.currentValue);
}