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

C# Serialization.ODataSerializerProvider类代码示例

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

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



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

示例1: CreateApplicationJson

        private static ODataMediaTypeFormatter CreateApplicationJson(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
        {
            ODataMediaTypeFormatter formatter = CreateFormatterWithoutMediaTypes(
                serializerProvider,
                deserializerProvider,
                ODataPayloadKind.Feed,
                ODataPayloadKind.Entry,
                ODataPayloadKind.Property,
                ODataPayloadKind.EntityReferenceLink,
                ODataPayloadKind.EntityReferenceLinks,
                ODataPayloadKind.Collection,
                ODataPayloadKind.ServiceDocument,
                ODataPayloadKind.Error,
                ODataPayloadKind.Parameter);

            // Add minimal metadata as the first media type so it gets used when the request doesn't
            // ask for a specific content type
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataMinimalMetadataStreamingTrue);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataMinimalMetadataStreamingFalse);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataMinimalMetadata);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataFullMetadataStreamingTrue);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataFullMetadataStreamingFalse);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataFullMetadata);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataNoMetadataStreamingTrue);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataNoMetadataStreamingFalse);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataNoMetadata);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonODataVerbose);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonStreamingTrue);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJsonStreamingFalse);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationJson);
            return formatter;
        }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:32,代码来源:ODataMediaTypeFormatters.cs


示例2: CreateApplicationAtomXmlTypeFeed

 private static ODataMediaTypeFormatter CreateApplicationAtomXmlTypeFeed(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
 {
     ODataMediaTypeFormatter formatter = CreateFormatterWithoutMediaTypes(serializerProvider, deserializerProvider, ODataPayloadKind.Feed);
     formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationAtomXmlTypeFeed);
     formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationAtomXml);
     return formatter;
 }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:7,代码来源:ODataMediaTypeFormatters.cs


示例3: ODataMediaTypeFormatter

        /// <summary>
        /// Initializes a new instance of the <see cref="ODataMediaTypeFormatter"/> class.
        /// </summary>
        /// <param name="deserializerProvider">The <see cref="ODataDeserializerProvider"/> to use.</param>
        /// <param name="serializerProvider">The <see cref="ODataSerializerProvider"/> to use.</param>
        /// <param name="payloadKinds">The kind of payloads this formatter supports.</param>
        public ODataMediaTypeFormatter(ODataDeserializerProvider deserializerProvider, ODataSerializerProvider serializerProvider,
            IEnumerable<ODataPayloadKind> payloadKinds)
        {
            if (deserializerProvider == null)
            {
                throw Error.ArgumentNull("deserializerProvider");
            }
            if (serializerProvider == null)
            {
                throw Error.ArgumentNull("serializerProvider");
            }
            if (payloadKinds == null)
            {
                throw Error.ArgumentNull("payloadKinds");
            }

            _deserializerProvider = deserializerProvider;
            _serializerProvider = serializerProvider;
            _payloadKinds = payloadKinds;

            // Maxing out the received message size as we depend on the hosting layer to enforce this limit.
            MessageWriterSettings = new ODataMessageWriterSettings
            {
                Indent = true,
                DisableMessageStreamDisposal = true,
                MessageQuotas = new ODataMessageQuotas { MaxReceivedMessageSize = Int64.MaxValue }
            };
            MessageReaderSettings = new ODataMessageReaderSettings
            {
                DisableMessageStreamDisposal = true,
                MessageQuotas = new ODataMessageQuotas { MaxReceivedMessageSize = Int64.MaxValue },
            };

            _version = DefaultODataVersion;
        }
开发者ID:sstrazan,项目名称:aspnetwebstack,代码行数:41,代码来源:ODataMediaTypeFormatter.cs


示例4: CreateRawValue

 private static ODataMediaTypeFormatter CreateRawValue(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
 {
     ODataMediaTypeFormatter formatter = CreateFormatterWithoutMediaTypes(serializerProvider, deserializerProvider, ODataPayloadKind.Value);
     formatter.MediaTypeMappings.Add(new ODataPrimitiveValueMediaTypeMapping());
     formatter.MediaTypeMappings.Add(new ODataBinaryValueMediaTypeMapping());
     return formatter;
 }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:7,代码来源:ODataMediaTypeFormatters.cs


示例5: ODataCollectionSerializer

 public ODataCollectionSerializer(IEdmCollectionTypeReference edmCollectionType, ODataSerializerProvider serializerProvider)
     : base(edmCollectionType, ODataPayloadKind.Collection, serializerProvider)
 {
     Contract.Assert(edmCollectionType != null);
     _edmCollectionType = edmCollectionType;
     IEdmTypeReference itemType = edmCollectionType.ElementType();
     Contract.Assert(itemType != null);
     _edmItemType = itemType;
 }
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:9,代码来源:ODataCollectionSerializer.cs


示例6: ODataFeedSerializer

 public ODataFeedSerializer(IEdmCollectionTypeReference edmCollectionType, ODataSerializerProvider serializerProvider)
     : base(edmCollectionType, ODataPayloadKind.Feed, serializerProvider)
 {
     _edmCollectionType = edmCollectionType;
     if (!edmCollectionType.ElementType().IsEntity())
     {
         throw Error.NotSupported(SRResources.TypeMustBeEntityCollection, edmCollectionType.ElementType().FullName(), typeof(IEdmEntityType).Name);
     }
 }
开发者ID:mikevpeters,项目名称:aspnetwebstack,代码行数:9,代码来源:ODataFeedSerializer.cs


示例7: CreateApplicationAtomSvcXml

        private static ODataMediaTypeFormatter CreateApplicationAtomSvcXml(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
        {
            ODataMediaTypeFormatter formatter = CreateFormatterWithoutMediaTypes(serializerProvider, deserializerProvider, ODataPayloadKind.ServiceDocument);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationAtomSvcXml);

            formatter.AddDollarFormatQueryStringMappings();

            return formatter;
        }
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:9,代码来源:ODataMediaTypeFormatters.cs


示例8: ODataEntrySerializer

        protected ODataEntrySerializer(IEdmTypeReference edmType, ODataPayloadKind odataPayloadKind, ODataSerializerProvider serializerProvider)
            : this(edmType, odataPayloadKind)
        {
            if (serializerProvider == null)
            {
                throw Error.ArgumentNull("serializerProvider");
            }

            SerializerProvider = serializerProvider;
        }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:10,代码来源:ODataEntrySerializer.cs


示例9: ODataEdmTypeSerializer

        /// <summary>
        /// Initializes a new instance of the <see cref="ODataEdmTypeSerializer"/> class.
        /// </summary>
        /// <param name="payloadKind">The kind of OData payload that this serializer generates.</param>
        /// <param name="serializerProvider">The <see cref="ODataSerializerProvider"/> to use to write inner objects.</param>
        protected ODataEdmTypeSerializer(ODataPayloadKind payloadKind, ODataSerializerProvider serializerProvider)
            : this(payloadKind)
        {
            if (serializerProvider == null)
            {
                throw Error.ArgumentNull("serializerProvider");
            }

            SerializerProvider = serializerProvider;
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:15,代码来源:ODataEdmTypeSerializer.cs


示例10: CreateApplicationAtomXmlTypeEntry

        private static ODataMediaTypeFormatter CreateApplicationAtomXmlTypeEntry(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
        {
            ODataMediaTypeFormatter formatter = CreateFormatterWithoutMediaTypes(serializerProvider, deserializerProvider, ODataPayloadKind.Entry);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationAtomXmlTypeEntry);
            formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationAtomXml);

            formatter.AddDollarFormatQueryStringMappings();
            formatter.AddQueryStringMapping(DollarFormat, AtomFormat, ODataMediaTypes.ApplicationAtomXml);

            return formatter;
        }
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:11,代码来源:ODataMediaTypeFormatters.cs


示例11: ODataCollectionSerializer

        /// <summary>
        /// Initializes a new instance of the <see cref="ODataCollectionSerializer"/> class.
        /// </summary>
        /// <param name="edmType">The edm collection type this serializer instance can serialize.</param>
        /// <param name="serializerProvider">The serializer provider to use to serialize nested objects.</param>
        public ODataCollectionSerializer(IEdmCollectionTypeReference edmType, ODataSerializerProvider serializerProvider)
            : base(edmType, ODataPayloadKind.Collection, serializerProvider)
        {
            IEdmTypeReference itemType = edmType.ElementType();
            if (itemType == null)
            {
                throw Error.Argument("edmType", SRResources.ItemTypeOfCollectionNull, edmType.FullName());
            }

            CollectionType = edmType;
            ElementType = itemType;
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:17,代码来源:ODataCollectionSerializer.cs


示例12: ODataMediaTypeFormatter

        internal ODataMediaTypeFormatter(ODataDeserializerProvider oDataDeserializerProvider, ODataSerializerProvider oDataSerializerProvider)
        {
            ODataDeserializerProvider = oDataDeserializerProvider;
            Model = oDataDeserializerProvider.EdmModel;
            ODataSerializerProvider = oDataSerializerProvider;

            SupportedMediaTypes.Add(ODataFormatterConstants.ApplicationAtomXmlMediaType);
            SupportedMediaTypes.Add(ODataFormatterConstants.ApplicationJsonMediaType);
            SupportedMediaTypes.Add(ODataFormatterConstants.ApplicationXmlMediaType);

            SupportedEncodings.Add(new UnicodeEncoding(bigEndian: false, byteOrderMark: true, throwOnInvalidBytes: true));
            SupportedEncodings.Add(new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true));
        }
开发者ID:mikevpeters,项目名称:aspnetwebstack,代码行数:13,代码来源:ODataMediaTypeFormatter.cs


示例13: Create

 /// <summary>
 /// Creates a list of media type formatters to handle OData.
 /// </summary>
 /// <param name="serializerProvider">The serializer provider to use.</param>
 /// <param name="deserializerProvider">The deserializer provider to use.</param>
 /// <returns>A list of media type formatters to handle OData.</returns>
 public static IList<ODataMediaTypeFormatter> Create(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
 {
     return new List<ODataMediaTypeFormatter>()
     {
         // Create atomsvc+xml formatter first to handle service document requests without an Accept header in an XML format
         CreateApplicationAtomSvcXml(serializerProvider, deserializerProvider),
         // Create JSON formatter next so it gets used when the request doesn't ask for a specific content type
         CreateApplicationJson(serializerProvider, deserializerProvider),
         CreateApplicationAtomXmlTypeFeed(serializerProvider, deserializerProvider),
         CreateApplicationAtomXmlTypeEntry(serializerProvider, deserializerProvider),
         CreateApplicationXml(serializerProvider, deserializerProvider),
         CreateTextXml(serializerProvider, deserializerProvider)
     };
 }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:20,代码来源:ODataMediaTypeFormatters.cs


示例14: ODataFeedSerializer

        public ODataFeedSerializer(IEdmCollectionTypeReference edmCollectionType, ODataSerializerProvider serializerProvider)
            : base(edmCollectionType, ODataPayloadKind.Feed, serializerProvider)
        {
            Contract.Assert(edmCollectionType != null);
            _edmCollectionType = edmCollectionType;
            if (!edmCollectionType.ElementType().IsEntity())
            {
                throw Error.NotSupported(SRResources.TypeMustBeEntityCollection, edmCollectionType.ElementType().FullName(), typeof(IEdmEntityType).Name);
            }

            Contract.Assert(edmCollectionType.ElementType() != null);
            Contract.Assert(edmCollectionType.ElementType().AsEntity() != null);
            Contract.Assert(edmCollectionType.ElementType().AsEntity().Definition != null);
            Contract.Assert(edmCollectionType.ElementType().AsEntity().Definition as IEdmEntityType != null);
            _edmElementType = _edmCollectionType.ElementType().AsEntity().Definition as IEdmEntityType;
        }
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:16,代码来源:ODataFeedSerializer.cs


示例15: ODataMediaTypeFormatter

        private ODataMediaTypeFormatter(ODataDeserializerProvider deserializerProvider,
            ODataSerializerProvider serializerProvider,
            IEnumerable<ODataPayloadKind> payloadKinds,
            ODataVersion version,
            HttpRequestMessage request)
        {
            Contract.Assert(deserializerProvider != null);
            Contract.Assert(deserializerProvider.EdmModel != null);
            Contract.Assert(serializerProvider != null);
            Contract.Assert(payloadKinds != null);

            _deserializerProvider = deserializerProvider;
            _model = deserializerProvider.EdmModel;
            _serializerProvider = serializerProvider;
            _payloadKinds = payloadKinds;
            _version = version;
            _request = request;
        }
开发者ID:jlamfers,项目名称:aspnetwebstack,代码行数:18,代码来源:ODataMediaTypeFormatter.cs


示例16: ODataMediaTypeFormatter

        internal ODataMediaTypeFormatter(ODataDeserializerProvider deserializerProvider,
            ODataSerializerProvider serializerProvider,
            IEnumerable<ODataPayloadKind> payloadKinds,
            ODataVersion version,
            HttpRequestMessage request)
        {
            Contract.Assert(deserializerProvider != null);
            Contract.Assert(serializerProvider != null);
            Contract.Assert(payloadKinds != null);

            _deserializerProvider = deserializerProvider;
            _serializerProvider = serializerProvider;
            _payloadKinds = payloadKinds;
            _version = version;
            _request = request;

            // Maxing out the received message size as we depend on the hosting layer to enforce this limit.
            MessageReaderQuotas = new ODataMessageQuotas { MaxReceivedMessageSize = Int64.MaxValue };
            MessageWriterQuotas = new ODataMessageQuotas { MaxReceivedMessageSize = Int64.MaxValue };
        }
开发者ID:balajivasudevan,项目名称:aspnetwebstack,代码行数:20,代码来源:ODataMediaTypeFormatter.cs


示例17: ODataEntityTypeSerializerTests

        public ODataEntityTypeSerializerTests()
        {
            _model = SerializationTestsHelpers.SimpleCustomerOrderModel();

            _model.SetAnnotationValue<ClrTypeAnnotation>(_model.FindType("Default.Customer"), new ClrTypeAnnotation(typeof(Customer)));
            _model.SetAnnotationValue<ClrTypeAnnotation>(_model.FindType("Default.Order"), new ClrTypeAnnotation(typeof(Order)));

            _customerSet = _model.FindDeclaredEntityContainer("Default.Container").FindEntitySet("Customers");
            _customer = new Customer()
            {
                FirstName = "Foo",
                LastName = "Bar",
                ID = 10,
            };

            _serializerProvider = new DefaultODataSerializerProvider();
            _customerType = _model.GetEdmTypeReference(typeof(Customer)).AsEntity();
            _serializer = new ODataEntityTypeSerializer(_serializerProvider);
            _writeContext = new ODataSerializerContext() { EntitySet = _customerSet, Model = _model };
            _entityInstanceContext = new EntityInstanceContext(_writeContext, _customerSet.ElementType.AsReference(), _customer);
        }
开发者ID:normalian,项目名称:aspnetwebstack,代码行数:21,代码来源:ODataEntityTypeSerializerTests.cs


示例18: CreateFormatterWithoutMediaTypes

 private static ODataMediaTypeFormatter CreateFormatterWithoutMediaTypes(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider, params ODataPayloadKind[] payloadKinds)
 {
     ODataMediaTypeFormatter formatter = new ODataMediaTypeFormatter(deserializerProvider, serializerProvider, payloadKinds);
     AddSupportedEncodings(formatter);
     return formatter;
 }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:6,代码来源:ODataMediaTypeFormatters.cs


示例19: CreateApplicationXml

 private static ODataMediaTypeFormatter CreateApplicationXml(ODataSerializerProvider serializerProvider, ODataDeserializerProvider deserializerProvider)
 {
     ODataMediaTypeFormatter formatter = CreateFormatterWithoutMediaTypes(
         serializerProvider,
         deserializerProvider,
         ODataPayloadKind.Property,
         ODataPayloadKind.EntityReferenceLink,
         ODataPayloadKind.EntityReferenceLinks,
         ODataPayloadKind.Collection,
         ODataPayloadKind.ServiceDocument,
         ODataPayloadKind.MetadataDocument,
         ODataPayloadKind.Error);
     formatter.SupportedMediaTypes.Add(ODataMediaTypes.ApplicationXml);
     return formatter;
 }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:15,代码来源:ODataMediaTypeFormatters.cs


示例20: CustomFeedSerializer

 public CustomFeedSerializer(ODataSerializerProvider serializerProvider)
     : base(serializerProvider)
 {
 }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:4,代码来源:ODataFormatterTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.SelectExpandNode类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.ODataSerializerContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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