Esempio n. 1
0
        internal static ODataMessageReaderSettings CreateReaderSettings(
            IServiceProvider container,
            ODataMessageReaderSettings other)
        {
            ODataMessageReaderSettings readerSettings;

            if (container == null)
            {
                readerSettings = new ODataMessageReaderSettings();
            }
            else
            {
                readerSettings = container.GetRequiredService <ODataMessageReaderSettings>();
            }

            if (other != null)
            {
                readerSettings.CopyFrom(other);
            }

            return(readerSettings);
        }
        private void CopyFrom(ODataMessageReaderSettings other)
        {
            ExceptionUtils.CheckArgumentNotNull(other, "other");

            this.BaseUri = other.BaseUri;
            this.ClientCustomTypeResolver      = other.ClientCustomTypeResolver;
            this.PrimitiveTypeResolver         = other.PrimitiveTypeResolver;
            this.EnableMessageStreamDisposal   = other.EnableMessageStreamDisposal;
            this.EnablePrimitiveTypeConversion = other.EnablePrimitiveTypeConversion;
            this.EnableCharactersCheck         = other.EnableCharactersCheck;
            this.messageQuotas                           = new ODataMessageQuotas(other.MessageQuotas);
            this.MaxProtocolVersion                      = other.MaxProtocolVersion;
            this.ReadUntypedAsString                     = other.ReadUntypedAsString;
            this.ShouldIncludeAnnotation                 = other.ShouldIncludeAnnotation;
            this.validations                             = other.validations;
            this.ThrowOnDuplicatePropertyNames           = other.ThrowOnDuplicatePropertyNames;
            this.ThrowIfTypeConflictsWithMetadata        = other.ThrowIfTypeConflictsWithMetadata;
            this.ThrowOnUndeclaredPropertyForNonOpenType = other.ThrowOnUndeclaredPropertyForNonOpenType;
            this.LibraryCompatibility                    = other.LibraryCompatibility;
            this.Version          = other.Version;
            this.ReadAsStreamFunc = other.ReadAsStreamFunc;
            this.ArrayPool        = other.ArrayPool;
        }
Esempio n. 3
0
 /// <summary>
 /// Creates an instance of the input context for this format.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="messageReaderSettings">Configuration settings of the OData reader.</param>
 /// <returns>The newly created input context.</returns>
 public abstract ODataInputContext CreateInputContext(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings);
Esempio n. 4
0
 /// <summary>
 /// Detects the payload kinds supported by this format for the specified message payload.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="settings">Configuration settings of the OData reader.</param>
 /// <returns>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
 /// <remarks>
 /// The stream returned by GetMessageStream of <paramref name="messageInfo"/> could be used for reading for
 /// payload kind detection. Reading this stream won't affect later reading operations of payload processing.
 /// </remarks>
 public abstract IEnumerable <ODataPayloadKind> DetectPayloadKind(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings);
Esempio n. 5
0
 /// <summary>
 /// Asynchronously creates an instance of the input context for this format.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="messageReaderSettings">Configuration settings of the OData reader.</param>
 /// <returns>Task which when completed returned the newly created input context.</returns>
 public abstract Task <ODataInputContext> CreateInputContextAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings);
Esempio n. 6
0
 /// <summary>
 /// Asynchronously detects the payload kinds supported by this format for the specified message payload.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="settings">Configuration settings of the OData reader.</param>
 /// <returns>A task that when completed returns the set of <see cref="ODataPayloadKind"/>s
 /// that are supported with the specified payload.</returns>
 /// <remarks>
 /// The stream returned by GetMessageStream of <paramref name="messageInfo"/> could be used for reading for
 /// payload kind detection. Reading this stream won't affect later reading operations of payload processing.
 /// </remarks>
 public abstract Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings);
 /// <summary>
 /// Constructs a ReaderValidator instance that binds to settings.
 /// </summary>
 /// <param name="settings">The ODataMessageReaderSettings instance to bind to.</param>
 internal ReaderValidator(ODataMessageReaderSettings settings)
 {
     this.settings = settings;
 }