当前位置: 首页>>代码示例>>C#>>正文


C# ODataDeserializerContext.GetEdmType方法代码示例

本文整理汇总了C#中System.Web.OData.Formatter.Deserialization.ODataDeserializerContext.GetEdmType方法的典型用法代码示例。如果您正苦于以下问题:C# ODataDeserializerContext.GetEdmType方法的具体用法?C# ODataDeserializerContext.GetEdmType怎么用?C# ODataDeserializerContext.GetEdmType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.OData.Formatter.Deserialization.ODataDeserializerContext的用法示例。


在下文中一共展示了ODataDeserializerContext.GetEdmType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

        /// <inheritdoc />
        public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
        {
            if (messageReader == null)
            {
                throw Error.ArgumentNull("messageReader");
            }

            IEdmTypeReference edmType = readContext.GetEdmType(type);
            Contract.Assert(edmType != null);

            ODataProperty property = messageReader.ReadProperty();
            return ReadInline(property, edmType, readContext);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:14,代码来源:ODataPrimitiveDeserializer.cs

示例2: Read

        /// <inheritdoc />
        public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
        {
            if (messageReader == null)
            {
                throw Error.ArgumentNull("messageReader");
            }

            IEdmTypeReference edmType = readContext.GetEdmType(type);
            Contract.Assert(edmType != null);

            if (!edmType.IsComplex())
            {
                throw Error.Argument("type", SRResources.ArgumentMustBeOfType, EdmTypeKind.Complex);
            }

            ODataProperty property = messageReader.ReadProperty();
            return ReadInline(property, edmType, readContext);
        }
开发者ID:chinadragon0515,项目名称:WebApi,代码行数:19,代码来源:ODataComplexTypeDeserializer.cs

示例3: Read

        /// <inheritdoc />
        public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
        {
            if (messageReader == null)
            {
                throw Error.ArgumentNull("messageReader");
            }

            IEdmTypeReference edmType = readContext.GetEdmType(type);
            Contract.Assert(edmType != null);

            if (!edmType.IsCollection())
            {
                throw Error.Argument("type", SRResources.ArgumentMustBeOfType, EdmTypeKind.Collection);
            }

            IEdmCollectionTypeReference collectionType = edmType.AsCollection();
            IEdmTypeReference elementType = collectionType.ElementType();
            ODataCollectionReader reader = messageReader.CreateODataCollectionReader(elementType);
            return ReadInline(ReadCollection(reader), edmType, readContext);
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:21,代码来源:ODataCollectionDeserializer.cs

示例4: Read

        /// <inheritdoc />
        public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
        {
            if (messageReader == null)
            {
                throw Error.ArgumentNull("messageReader");
            }

            if (readContext == null)
            {
                throw Error.ArgumentNull("readContext");
            }

            if (readContext.Path == null)
            {
                throw Error.Argument("readContext", SRResources.ODataPathMissing);
            }

            IEdmEntitySet entitySet = GetEntitySet(readContext.Path);
            if (entitySet == null)
            {
                throw new SerializationException(SRResources.EntitySetMissingDuringDeserialization);
            }

            IEdmTypeReference edmType = readContext.GetEdmType(type);
            Contract.Assert(edmType != null);

            if (!edmType.IsEntity())
            {
                throw Error.Argument("type", SRResources.ArgumentMustBeOfType, EdmTypeKind.Entity);
            }

            IEdmEntityTypeReference entityType = edmType.AsEntity();

            ODataReader odataReader = messageReader.CreateODataEntryReader(entitySet, entityType.EntityDefinition());
            ODataEntryWithNavigationLinks topLevelEntry = ReadEntryOrFeed(odataReader) as ODataEntryWithNavigationLinks;
            Contract.Assert(topLevelEntry != null);

            return ReadInline(topLevelEntry, entityType, readContext);
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:40,代码来源:ODataEntityDeserializer.cs


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