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


C# ODataDeserializerProvider.GetODataDeserializer方法代码示例

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


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

示例1: GetDeserializer

        private ODataDeserializer GetDeserializer(Type type, ODataPath path, IEdmModel model,
            ODataDeserializerProvider deserializerProvider, out IEdmTypeReference expectedPayloadType)
        {
            expectedPayloadType = GetExpectedPayloadType(type, path, model);

            // Get the deserializer using the CLR type first from the deserializer provider.
            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(model, type, Request);
            if (deserializer == null && expectedPayloadType != null)
            {
                // we are in typeless mode, get the deserializer using the edm type from the path.
                deserializer = deserializerProvider.GetEdmTypeDeserializer(expectedPayloadType);
            }

            return deserializer;
        }
开发者ID:sstrazan,项目名称:aspnetwebstack,代码行数:15,代码来源:ODataMediaTypeFormatter.cs

示例2: ConvertCollectionValue

        private static object ConvertCollectionValue(ODataCollectionValue collection, IEdmTypeReference propertyType, ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)
        {
            IEdmCollectionTypeReference collectionType = propertyType as IEdmCollectionTypeReference;
            Contract.Assert(collectionType != null, "The type for collection must be a IEdmCollectionType.");

            ODataEntryDeserializer deserializer = deserializerProvider.GetODataDeserializer(collectionType);
            return deserializer.ReadInline(collection, readContext);
        }
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:8,代码来源:ODataEntryDeserializer.cs

示例3: GetDeserializer

        private ODataDeserializer GetDeserializer(Type type, ODataPath path, IEdmModel model,
            ODataDeserializerProvider deserializerProvider, out IEdmTypeReference expectedPayloadType)
        {
            expectedPayloadType = GetExpectedPayloadType(type, path, model);

            if (expectedPayloadType != null)
            {
                return deserializerProvider.GetEdmTypeDeserializer(expectedPayloadType);
            }
            else
            {
                return deserializerProvider.GetODataDeserializer(model, type, Request);
            }
        }
开发者ID:jaceenet,项目名称:aspnetwebstack,代码行数:14,代码来源:ODataMediaTypeFormatter.cs

示例4: ConvertComplexValue

        private static object ConvertComplexValue(ODataComplexValue complexValue, ref IEdmTypeReference propertyType, ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)
        {
            IEdmComplexTypeReference edmComplexType;
            if (propertyType == null)
            {
                // open complex property
                Contract.Assert(!String.IsNullOrEmpty(complexValue.TypeName), "ODataLib should have verified that open complex value has a type name since we provided metadata.");
                IEdmModel model = readContext.Model;
                IEdmType edmType = model.FindType(complexValue.TypeName);
                Contract.Assert(edmType.TypeKind == EdmTypeKind.Complex, "ODataLib should have verified that complex value has a complex resource type.");
                edmComplexType = new EdmComplexTypeReference(edmType as IEdmComplexType, isNullable: true);
            }
            else
            {
                edmComplexType = propertyType.AsComplex();
            }

            ODataEntryDeserializer deserializer = deserializerProvider.GetODataDeserializer(edmComplexType);
            return deserializer.ReadInline(complexValue, readContext);
        }
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:20,代码来源:ODataEntryDeserializer.cs

示例5: GetDeserializer

        private ODataDeserializer GetDeserializer(Type type, ODataPath path, IEdmModel model, ODataDeserializerProvider deserializerProvider)
        {
            if (typeof(IEdmObject).IsAssignableFrom(type))
            {
                // typeless mode. figure out the expected payload type from the OData Path.
                IEdmType edmType = path.EdmType;
                if (edmType != null)
                {
                    IEdmTypeReference expectedPayloadType = EdmLibHelpers.ToEdmTypeReference(edmType, isNullable: false);
                    if (expectedPayloadType.TypeKind() == EdmTypeKind.Collection)
                    {
                        IEdmTypeReference elementType = expectedPayloadType.AsCollection().ElementType();
                        if (elementType.IsEntity())
                        {
                            // collection of entities cannot be CREATE/UPDATEd. Instead, the request would contain a single entry.
                            expectedPayloadType = elementType;
                        }
                    }

                    if (expectedPayloadType != null)
                    {
                        return deserializerProvider.GetEdmTypeDeserializer(expectedPayloadType);
                    }
                }
            }
            else
            {
                TryGetInnerTypeForDelta(ref type);
                return deserializerProvider.GetODataDeserializer(model, type, Request);
            }

            return null;
        }
开发者ID:jeremy-bridges,项目名称:aspnetwebstack,代码行数:33,代码来源:ODataMediaTypeFormatter.cs


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