本文整理汇总了C#中Microsoft.OData.Core.ODataEntry.Property方法的典型用法代码示例。如果您正苦于以下问题:C# ODataEntry.Property方法的具体用法?C# ODataEntry.Property怎么用?C# ODataEntry.Property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Core.ODataEntry
的用法示例。
在下文中一共展示了ODataEntry.Property方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EntryMetadataUrlRoundTrip
public void EntryMetadataUrlRoundTrip()
{
var stream = new MemoryStream();
var writerRequestMemoryMessage = new InMemoryMessage();
writerRequestMemoryMessage.Stream = stream;
writerRequestMemoryMessage.SetHeader("Content-Type", "application/json");
var writerSettings = new ODataMessageWriterSettings() {Version = ODataVersion.V4, DisableMessageStreamDisposal = true};
writerSettings.ODataUri = new ODataUri() {ServiceRoot = new Uri("http://christro.svc/")};
var messageWriter = new ODataMessageWriter((IODataResponseMessage)writerRequestMemoryMessage, writerSettings, this.model);
var organizationSetWriter = messageWriter.CreateODataEntryWriter(this.organizationsSet);
var odataEntry = new ODataEntry(){ TypeName = ModelNamespace + ".Corporation" };
odataEntry.Property("Id", 1);
odataEntry.Property("Name", "");
odataEntry.Property("TickerSymbol", "MSFT");
organizationSetWriter.WriteStart(odataEntry);
organizationSetWriter.WriteEnd();
var readerPayloadInput = Encoding.UTF8.GetString(stream.GetBuffer());
Console.WriteLine(readerPayloadInput);
var readerResponseMemoryMessage = new InMemoryMessage();
readerResponseMemoryMessage.Stream = new MemoryStream(stream.GetBuffer());
readerResponseMemoryMessage.SetHeader("Content-Type", "application/json");
var messageReader = new ODataMessageReader((IODataResponseMessage)readerResponseMemoryMessage, new ODataMessageReaderSettings() {MaxProtocolVersion = ODataVersion.V4, DisableMessageStreamDisposal = true}, this.model);
var organizationReader = messageReader.CreateODataEntryReader(this.organizationsSet, this.organizationsSet.EntityType());
organizationReader.Read().Should().Be(true);
organizationReader.Item.As<ODataEntry>();
}