• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ODataItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ODataItem的典型用法代码示例。如果您正苦于以下问题:C# ODataItem类的具体用法?C# ODataItem怎么用?C# ODataItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ODataItem类属于命名空间,在下文中一共展示了ODataItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WriteNestedItems

        private static void WriteNestedItems(ODataItem[] nestedItemsToWrite, ODataAtomWriter writer)
        {
            foreach (ODataItem itemToWrite in nestedItemsToWrite)
            {
                ODataFeed feedToWrite = itemToWrite as ODataFeed;
                if (feedToWrite != null)
                {
                    writer.WriteStart(feedToWrite);
                }
                else
                {
                    ODataEntry entryToWrite = itemToWrite as ODataEntry;
                    if (entryToWrite != null)
                    {
                        writer.WriteStart(entryToWrite);
                    }
                    else
                    {
                        writer.WriteStart((ODataNavigationLink)itemToWrite);
                    }
                }
            }

            for (int count = 0; count < nestedItemsToWrite.Length; count++)
            {
                writer.WriteEnd();
            }
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:28,代码来源:ODataAtomWriterEnumIntegrationTests.cs


示例2: WriteRequestWithoutModelAndValidatePayload

 private void WriteRequestWithoutModelAndValidatePayload(ODataItem[] nestedItemToWrite, string expectedPayload, bool setMetadataDocumentUri = true)
 {
     // without model, write request
     // 1. CreateEntityContainerElementContextUri(): no entitySetName --> no context uri is output.
     // 2. but odata.type will be output because of no model. JsonMinimalMetadataTypeNameOracle.GetEntryTypeNameForWriting method: // We only write entity type names in Json Light if it's more derived (different) from the expected type name.
     var stream = new MemoryStream();
     var outputContext = CreateAtomOutputContext(stream, null, false, null);
     var writer = new ODataAtomWriter(outputContext, null, null, nestedItemToWrite[0] is ODataFeed);
     WriteNestedItems(nestedItemToWrite, writer);
     ValidateWrittenPayload(stream, writer, expectedPayload);
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:11,代码来源:ODataAtomWriterEnumIntegrationTests.cs


示例3: GetWriterOutputForContentTypeAndKnobValue

        private string GetWriterOutputForContentTypeAndKnobValue(
            string contentType,
            bool autoComputePayloadMetadataInJson,
            ODataItem[] itemsToWrite,
            EdmModel edmModel,
            IEdmEntitySetBase edmEntitySet,
            EdmEntityType edmEntityType,
            string selectClause = null,
            string expandClause = null,
            string resourcePath = null,
            bool enableFullValidation = true)
        {
            MemoryStream outputStream = new MemoryStream();
            IODataResponseMessage message = new InMemoryMessage() { Stream = outputStream };
            message.SetHeader("Content-Type", contentType);
            ODataMessageWriterSettings settings = new ODataMessageWriterSettings()
            {
                AutoComputePayloadMetadataInJson = autoComputePayloadMetadataInJson,
                EnableFullValidation = enableFullValidation
            };

            var result = new ODataQueryOptionParser(edmModel, edmEntityType, edmEntitySet, new Dictionary<string, string> { { "$expand", expandClause }, { "$select", selectClause } }).ParseSelectAndExpand();

            ODataUri odataUri = new ODataUri()
            {
                ServiceRoot = new Uri("http://example.org/odata.svc"),
                SelectAndExpand = result
            };

            if (resourcePath != null)
            {
                Uri requestUri = new Uri("http://example.org/odata.svc/" + resourcePath);
                odataUri.RequestUri = requestUri;
                odataUri.Path = new ODataUriParser(edmModel, new Uri("http://example.org/odata.svc/"), requestUri).ParsePath();
            }

            settings.ODataUri = odataUri;

            string output;
            using (var messageWriter = new ODataMessageWriter(message, settings, edmModel))
            {
                int currentIdx = 0;

                if (itemsToWrite[currentIdx] is ODataFeed)
                {
                    ODataWriter writer = messageWriter.CreateODataFeedWriter(edmEntitySet, edmEntityType);
                    this.WriteFeed(writer, itemsToWrite, ref currentIdx);
                }
                else if (itemsToWrite[currentIdx] is ODataEntry)
                {
                    ODataWriter writer = messageWriter.CreateODataEntryWriter(edmEntitySet, edmEntityType);
                    this.WriteEntry(writer, itemsToWrite, ref currentIdx);
                }
                else
                {
                    Assert.True(false, "Top level item to write must be entry or feed.");
                }

                currentIdx.Should().Be(itemsToWrite.Length, "Invalid list of items to write.");

                outputStream.Seek(0, SeekOrigin.Begin);
                output = new StreamReader(outputStream).ReadToEnd();
            }

            return output;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:66,代码来源:FullPayloadValidateTests.cs


示例4: WritingNestedInlinecountTest

        public void WritingNestedInlinecountTest()
        {
            ODataFeed feed = new ODataFeed { Count = 1 };

            ODataItem[] itemsToWrite = new ODataItem[]
            {
                new ODataFeed(), 
                this.entryWithOnlyData1,
                this.containedCollectionNavLink,
                feed
            };

            string resourcePath = "EntitySet";
            string result = this.GetWriterOutputForContentTypeAndKnobValue("application/json;odata.metadata=minimal", true, itemsToWrite, Model, EntitySet, EntityType, null, null, resourcePath);

            string expectedPayload = "{" +
                                            "\"@odata.context\":\"http://example.org/odata.svc/$metadata#EntitySet\"," +
                                            "\"value\":[" +
                                                "{" +
                                                    "\"ID\":101,\"Name\":\"Alice\"," +
                                                    "\"[email protected]\":\"http://example.org/odata.svc/$metadata#EntitySet(101)/ContainedCollectionNavProp\"," +
                                                    "\"[email protected]\":\"http://example.org/odata.svc/navigation\"," +
                                                    "\"[email protected]\":1," +
                                                    "\"ContainedCollectionNavProp\":[]" +
                                                "}" +
                                            "]" +
                                        "}";
            result.Should().Be(expectedPayload);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:29,代码来源:FullPayloadValidateTests.cs


示例5: WritingEntryExpandWithMixedCollectionAndNonCollectionContainedElementWithTypeCast

        public void WritingEntryExpandWithMixedCollectionAndNonCollectionContainedElementWithTypeCast()
        {
            ODataItem[] itemsToWrite = new ODataItem[]
            {
                this.entryWithOnlyData1,
                this.containedCollectionNavLink,
                new ODataFeed(), 
                this.entryWithOnlyData2,
                this.containedNavLink, 
                this.entryWithOnlyData3,
            };

            const string selectClause = "Namespace.DerivedType/ContainedCollectionNavProp";
            const string expandClause = "Namespace.DerivedType/ContainedCollectionNavProp($select=ContainedNavProp;$expand=ContainedNavProp)";
            string result = this.GetWriterOutputForContentTypeAndKnobValue("application/json;odata.metadata=minimal", true, itemsToWrite, Model, EntitySet, EntityType, selectClause, expandClause, "EntitySet(101)");

            string expectedPayload = "{\"@odata.context\":\"http://example.org/odata.svc/$metadata#EntitySet(Namespace.DerivedType/ContainedCollectionNavProp,Namespace.DerivedType/ContainedCollectionNavProp(ContainedNavProp))/$entity\"," +
                                        "\"ID\":101,\"Name\":\"Alice\"," +
                                        "\"[email protected]\":\"http://example.org/odata.svc/$metadata#EntitySet(101)/Namespace.DerivedType/ContainedCollectionNavProp(ContainedNavProp)\"," +
                                        "\"[email protected]\":\"http://example.org/odata.svc/navigation\"," +
                                        "\"ContainedCollectionNavProp\":" +
                                            "[" +
                                                "{" +
                                                    "\"ID\":102,\"Name\":\"Bob\"," +
                                                    "\"[email protected]\":\"http://example.org/odata.svc/$metadata#EntitySet(101)/Namespace.DerivedType/ContainedCollectionNavProp(102)/ContainedNavProp/$entity\"," +
                                                    "\"ContainedNavProp\":" +
                                                    "{" +
                                                        "\"ID\":103,\"Name\":\"Charlie\"" +
                                                    "}" +
                                                "}" +
                                            "]" +
                                        "}";
            result.Should().Be(expectedPayload);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:34,代码来源:FullPayloadValidateTests.cs


示例6: WritingTopLevelContainedEntryWithTypeCast

        public void WritingTopLevelContainedEntryWithTypeCast()
        {
            ODataItem[] itemsToWrite = new ODataItem[]
            {
                this.entryWithOnlyData2
            };

            IEdmNavigationProperty containedNavProp = EntityType.FindProperty("ContainedNavProp") as IEdmNavigationProperty;
            IEdmEntitySetBase contianedEntitySet = EntitySet.FindNavigationTarget(containedNavProp) as IEdmEntitySetBase;
            string resourcePath = "EntitySet(123)/ContainedNavProp/Namespace.DerivedType";
            string result = this.GetWriterOutputForContentTypeAndKnobValue("application/json;odata.metadata=minimal", true, itemsToWrite, Model, contianedEntitySet, DerivedType, null, null, resourcePath);

            string expectedPayload = "{\"" +
                                            "@odata.context\":\"http://example.org/odata.svc/$metadata#EntitySet(123)/ContainedNavProp/Namespace.DerivedType/$entity\"," +
                                            "\"ID\":102,\"Name\":\"Bob\"" +
                                        "}";
            result.Should().Be(expectedPayload);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:18,代码来源:FullPayloadValidateTests.cs


示例7: DeltaFeedScope

            /// <summary>
            /// Constructor to create a new feed scope.
            /// </summary>
            /// <param name="item">The feed for the new scope.</param>
            /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
            /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
            /// <param name="selectedProperties">The selected properties of this scope.</param>
            /// <param name="odataUri">The ODataUri info of this scope.</param>
            protected DeltaFeedScope(ODataItem item, IEdmNavigationSource navigationSource, IEdmEntityType entityType, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
                : base(WriterState.DeltaFeed, item, navigationSource, entityType, selectedProperties, odataUri)
            {
                Debug.Assert(item != null, "item != null");

                var feed = item as ODataDeltaFeed;
                Debug.Assert(feed != null, "feed must be DeltaFeed.");

                this.serializationInfo = feed.SerializationInfo;
            }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:18,代码来源:ODataJsonLightDeltaWriter.cs


示例8: DeltaEntryScope

            /// <summary>
            /// Constructor to create a new entry scope.
            /// </summary>
            /// <param name="state">The writer state of this scope.</param>
            /// <param name="entry">The entry for the new scope.</param>
            /// <param name="serializationInfo">The serialization info for the current entry.</param>
            /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
            /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
            /// <param name="writerBehavior">The <see cref="ODataWriterBehavior"/> instance controlling the behavior of the writer.</param>
            /// <param name="selectedProperties">The selected properties of this scope.</param>
            /// <param name="odataUri">The ODataUri info of this scope.</param>
            protected DeltaEntryScope(WriterState state, ODataItem entry, ODataFeedAndEntrySerializationInfo serializationInfo, IEdmNavigationSource navigationSource, IEdmEntityType entityType, ODataWriterBehavior writerBehavior, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
                : base(state, entry, navigationSource, entityType, selectedProperties, odataUri)
            {
                Debug.Assert(entry != null, "entry != null");
                Debug.Assert(
                    state == WriterState.DeltaEntry && entry is ODataEntry ||
                    state == WriterState.DeltaDeletedEntry && entry is ODataDeltaDeletedEntry,
                    "entry must be either DeltaEntry or DeltaDeletedEntry.");
                Debug.Assert(writerBehavior != null, "writerBehavior != null");

                this.duplicatePropertyNamesChecker = new DuplicatePropertyNamesChecker(writerBehavior.AllowDuplicatePropertyNames, /*writingResponse*/ true);
                this.serializationInfo = serializationInfo;
            }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:24,代码来源:ODataJsonLightDeltaWriter.cs


示例9: Scope

 /// <summary>
 /// Constructor creating a new writer scope.
 /// </summary>
 /// <param name="state">The writer state of this scope.</param>
 /// <param name="item">The item attached to this scope.</param>
 /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
 /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
 /// <param name="selectedProperties">The selected properties of this scope.</param>
 /// <param name="odataUri">The ODataUri info of this scope.</param>
 internal Scope(WriterState state, ODataItem item, IEdmNavigationSource navigationSource, IEdmEntityType entityType, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
 {
     this.state = state;
     this.item = item;
     this.EntityType = entityType;
     this.NavigationSource = navigationSource;
     this.selectedProperties = selectedProperties;
     this.odataUri = odataUri;
 }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:18,代码来源:ODataJsonLightDeltaWriter.cs


示例10: GetLinkSerializationInfo

        /// <summary>
        /// Gets the serialization info for the given delta link.
        /// </summary>
        /// <param name="item">The entry to get the serialization info for.</param>
        /// <returns>The serialization info for the given entry.</returns>
        private ODataDeltaSerializationInfo GetLinkSerializationInfo(ODataItem item)
        {
            Debug.Assert(item != null, "item != null");

            ODataDeltaSerializationInfo serializationInfo = null;

            var deltaLink = item as ODataDeltaLink;
            if (deltaLink != null)
            {
                serializationInfo = deltaLink.SerializationInfo;
            }

            var deltaDeletedLink = item as ODataDeltaDeletedLink;
            if (deltaDeletedLink != null)
            {
                serializationInfo = deltaDeletedLink.SerializationInfo;
            }

            return serializationInfo ?? this.GetParentFeedSerializationInfo();
        }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:25,代码来源:ODataJsonLightDeltaWriter.cs


示例11: GetEntrySerializationInfo

        /// <summary>
        /// Gets the serialization info for the given delta entry.
        /// </summary>
        /// <param name="item">The entry to get the serialization info for.</param>
        /// <returns>The serialization info for the given entry.</returns>
        private ODataFeedAndEntrySerializationInfo GetEntrySerializationInfo(ODataItem item)
        {
            Debug.Assert(item != null, "item != null");

            ODataFeedAndEntrySerializationInfo serializationInfo = null;

            var entry = item as ODataEntry;
            if (entry != null)
            {
                serializationInfo = entry.SerializationInfo;
            }

            var deltaDeletedEntry = item as ODataDeltaDeletedEntry;
            if (deltaDeletedEntry != null)
            {
                serializationInfo = DeltaConverter.ToFeedAndEntrySerializationInfo(deltaDeletedEntry.SerializationInfo);
            }

            if (serializationInfo == null)
            {
                serializationInfo = DeltaConverter.ToFeedAndEntrySerializationInfo(this.GetParentFeedSerializationInfo());
            }

            return serializationInfo;
        }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:30,代码来源:ODataJsonLightDeltaWriter.cs


示例12: CreateDeltaLinkScope

 /// <summary>
 /// Create a new delta link scope.
 /// </summary>
 /// <param name="state">The writer state of the scope to create.</param>
 /// <param name="link">The link for the new scope.</param>
 /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
 /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
 /// <param name="selectedProperties">The selected properties of this scope.</param>
 /// <param name="odataUri">The ODataUri info of this scope.</param>
 /// <returns>The newly create scope.</returns>
 private DeltaLinkScope CreateDeltaLinkScope(WriterState state, ODataItem link, IEdmNavigationSource navigationSource, IEdmEntityType entityType, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
 {
     return new JsonLightDeltaLinkScope(
         state,
         link,
         this.GetLinkSerializationInfo(link),
         navigationSource,
         entityType,
         this.jsonLightOutputContext.MessageWriterSettings.WriterBehavior,
         selectedProperties,
         odataUri);
 }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:22,代码来源:ODataJsonLightDeltaWriter.cs


示例13: CreateDeltaFeedScope

 /// <summary>
 /// Create a new delta feed scope.
 /// </summary>
 /// <param name="feed">The feed for the new scope.</param>
 /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
 /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
 /// <param name="selectedProperties">The selected properties of this scope.</param>
 /// <param name="odataUri">The ODataUri info of this scope.</param>
 /// <returns>The newly create scope.</returns>
 private DeltaFeedScope CreateDeltaFeedScope(ODataItem feed, IEdmNavigationSource navigationSource, IEdmEntityType entityType, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
 {
     return new JsonLightDeltaFeedScope(feed, navigationSource, entityType, selectedProperties, odataUri);
 }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:13,代码来源:ODataJsonLightDeltaWriter.cs


示例14: WriteEntry

        private void WriteEntry(ODataWriter writer, ODataItem[] itemsToWrite, ref int currentIdx)
        {
            if (currentIdx < itemsToWrite.Length)
            {
                ODataEntry entry = (ODataEntry)itemsToWrite[currentIdx++];
                writer.WriteStart(entry);
                while (currentIdx < itemsToWrite.Length)
                {
                    if (itemsToWrite[currentIdx] is ODataNavigationLink)
                    {
                        this.WriteLink(writer, itemsToWrite, ref currentIdx);
                    }
                    else if (itemsToWrite[currentIdx] is ODataNavigationLinkEnd)
                    {
                        currentIdx++;
                        writer.WriteEnd();
                        return;
                    }
                    else
                    {
                        break;
                    }
                }

                writer.WriteEnd();
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:27,代码来源:FullPayloadValidateTests.cs


示例15: WriteLink

        private void WriteLink(ODataWriter writer, ODataItem[] itemsToWrite, ref int currentIdx)
        {
            if (currentIdx < itemsToWrite.Length)
            {
                ODataNavigationLink link = (ODataNavigationLink)itemsToWrite[currentIdx++];
                writer.WriteStart(link);
                if (currentIdx < itemsToWrite.Length)
                {
                    if (itemsToWrite[currentIdx] is ODataEntry)
                    {
                        this.WriteEntry(writer, itemsToWrite, ref currentIdx);
                    }
                    else if (itemsToWrite[currentIdx] is ODataFeed)
                    {
                        this.WriteFeed(writer, itemsToWrite, ref currentIdx);
                    }
                }

                writer.WriteEnd();
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:21,代码来源:FullPayloadValidateTests.cs


示例16: DeltaLinkScope

            /// <summary>
            /// Constructor to create a new delta link scope.
            /// </summary>
            /// <param name="state">The writer state of this scope.</param>
            /// <param name="link">The link for the new scope.</param>
            /// <param name="serializationInfo">The serialization info for the current entry.</param>
            /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
            /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
            /// <param name="writerBehavior">The <see cref="ODataWriterBehavior"/> instance controlling the behavior of the writer.</param>
            /// <param name="selectedProperties">The selected properties of this scope.</param>
            /// <param name="odataUri">The ODataUri info of this scope.</param>
            protected DeltaLinkScope(WriterState state, ODataItem link, ODataDeltaSerializationInfo serializationInfo, IEdmNavigationSource navigationSource, IEdmEntityType entityType, ODataWriterBehavior writerBehavior, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
                : base(state, link, navigationSource, entityType, selectedProperties, odataUri)
            {
                Debug.Assert(link != null, "link != null");
                Debug.Assert(
                    state == WriterState.DeltaLink && link is ODataDeltaLink ||
                    state == WriterState.DeltaDeletedLink && link is ODataDeltaDeletedLink,
                    "link must be either DeltaLink or DeltaDeletedLink.");
                Debug.Assert(writerBehavior != null, "writerBehavior != null");

                this.serializationInfo = DeltaConverter.ToFeedAndEntrySerializationInfo(serializationInfo);
            }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:23,代码来源:ODataJsonLightDeltaWriter.cs


示例17: WritingFeedWithFunctionAndAction

        public void WritingFeedWithFunctionAndAction()
        {
            ODataFeed feed = new ODataFeed();
            feed.AddAction(new ODataAction { Metadata = new Uri("http://example.org/odata.svc/$metadata#Action"), Target = new Uri("http://example.org/odata.svc/DoAction"), Title = "ActionTitle" });
            feed.AddFunction(new ODataFunction() { Metadata = new Uri("http://example.org/odata.svc/$metadata#Function"), Target = new Uri("http://example.org/odata.svc/DoFunction"), Title = "FunctionTitle" });

            ODataItem[] itemsToWrite = new ODataItem[]
            {
                feed,
                this.entryWithOnlyData1,
            };

            string result = this.GetWriterOutputForContentTypeAndKnobValue("application/json;odata.metadata=minimal", true, itemsToWrite, Model, EntitySet, EntityType);

            const string expectedPayload = "{\"" +
                                                "@odata.context\":\"http://example.org/odata.svc/$metadata#EntitySet\"," +
                                                 "\"#Action\":{" +
                                                        "\"title\":\"ActionTitle\"," +
                                                        "\"target\":\"http://example.org/odata.svc/DoAction\"" +
                                                    "}," +
                                                    "\"#Function\":{" +
                                                        "\"title\":\"FunctionTitle\"," +
                                                        "\"target\":\"http://example.org/odata.svc/DoFunction\"" +
                                                    "}," +
                                                "\"value\":[" +
                                                    "{" +
                                                         "\"ID\":101,\"Name\":\"Alice\"" +
                                                    "}" +
                                                    "]" +
                                            "}";
            result.Should().Be(expectedPayload);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:32,代码来源:FullPayloadValidateTests.cs


示例18: JsonLightDeltaFeedScope

 /// <summary>
 /// Constructor to create a new feed scope.
 /// </summary>
 /// <param name="feed">The feed for the new scope.</param>
 /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
 /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
 /// <param name="selectedProperties">The selected properties of this scope.</param>
 /// <param name="odataUri">The ODataUri info of this scope.</param>
 internal JsonLightDeltaFeedScope(ODataItem feed, IEdmNavigationSource navigationSource, IEdmEntityType entityType, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
     : base(feed, navigationSource, entityType, selectedProperties, odataUri)
 {
 }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:12,代码来源:ODataJsonLightDeltaWriter.cs


示例19: WritingEntryExpandWithMixedCollectionAndNonCollectionContainedElementAtSameLevel

        public void WritingEntryExpandWithMixedCollectionAndNonCollectionContainedElementAtSameLevel()
        {
            ODataItem[] itemsToWrite = new ODataItem[]
            {
                this.entryWithOnlyData1,
                this.expandedNavLink,
                this.entryWithOnlyData2,
                new ODataNavigationLinkEnd(),
                this.containedCollectionNavLink,
                new ODataFeed(), 
                this.entryWithOnlyData2,
                new ODataNavigationLinkEnd(), 
                this.containedNavLink, 
                this.entryWithOnlyData3,
            };

            const string selectClause = "ID,Name";
            const string expandClause = "ExpandedNavProp,ContainedCollectionNavProp($select=ID),ContainedNavProp($select=ID,Name)";
            string result = this.GetWriterOutputForContentTypeAndKnobValue("application/json;odata.metadata=minimal", true, itemsToWrite, Model, EntitySet, EntityType, selectClause, expandClause, "EntitySet(101)");

            string expectedPayload = "{\"@odata.context\":\"http://example.org/odata.svc/$metadata#EntitySet(ID,Name,ExpandedNavProp,ContainedCollectionNavProp,ContainedNavProp,ContainedCollectionNavProp(ID),ContainedNavProp(ID,Name))/$entity\"," +
                                            "\"ID\":101,\"Name\":\"Alice\"," +
                                            "\"ExpandedNavProp\":{\"ID\":102,\"Name\":\"Bob\"}," +
                                            "\"[email protected]\":\"http://example.org/odata.svc/$metadata#EntitySet(101)/ContainedCollectionNavProp(ID)\"," +
                                            "\"[email protected]\":\"http://example.org/odata.svc/navigation\"," +
                                            "\"ContainedCollectionNavProp\":[" +
                                                "{\"ID\":102,\"Name\":\"Bob\"}" +
                                            "]," +
                                            "\"[email protected]\":\"http://example.org/odata.svc/$metadata#EntitySet(101)/ContainedNavProp(ID,Name)/$entity\"," +
                                            "\"ContainedNavProp\":{\"ID\":103,\"Name\":\"Charlie\"}" +
                                        "}";
            result.Should().Be(expectedPayload);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:33,代码来源:FullPayloadValidateTests.cs


示例20: JsonLightDeltaLinkScope

 /// <summary>
 /// Constructor to create a new delta link scope.
 /// </summary>
 /// <param name="state">The writer state of this scope.</param>
 /// <param name="link">The link for the new scope.</param>
 /// <param name="serializationInfo">The serialization info for the current entry.</param>
 /// <param name="navigationSource">The navigation source we are going to write entities for.</param>
 /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
 /// <param name="writerBehavior">The <see cref="ODataWriterBehavior"/> instance controlling the behavior of the writer.</param>
 /// <param name="selectedProperties">The selected properties of this scope.</param>
 /// <param name="odataUri">The ODataUri info of this scope.</param>
 internal JsonLightDeltaLinkScope(WriterState state, ODataItem link, ODataDeltaSerializationInfo serializationInfo, IEdmNavigationSource navigationSource, IEdmEntityType entityType, ODataWriterBehavior writerBehavior, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
     : base(state, link, serializationInfo, navigationSource, entityType, writerBehavior, selectedProperties, odataUri)
 {
 }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:15,代码来源:ODataJsonLightDeltaWriter.cs



注:本文中的ODataItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ODataMessageReader类代码示例发布时间:2022-05-24
下一篇:
C# ODataFeed类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap