/// <summary>Initializes a new instance of the <see cref="Microsoft.OData.ODataMessageReaderSettings" /> class
        /// with default values for the specified OData version.</summary>
        /// <param name="odataVersion">OData Version for which to create default settings.</param>
        public ODataMessageReaderSettings(ODataVersion odataVersion)
        {
            this.ClientCustomTypeResolver      = null;
            this.PrimitiveTypeResolver         = null;
            this.EnablePrimitiveTypeConversion = true;
            this.EnableMessageStreamDisposal   = true;
            this.EnableCharactersCheck         = false;
            this.Version = odataVersion;
            this.LibraryCompatibility = ODataLibraryCompatibility.Latest;
            this.EnablePropertyNameCaseInsensitive = false; // for back-compatible

            Validator = new ReaderValidator(this);
            if (odataVersion < ODataVersion.V401)
            {
                Validations = ValidationKinds.All;
                this.ReadUntypedAsString = true;
                this.MaxProtocolVersion  = ODataConstants.ODataDefaultProtocolVersion;
            }
            else
            {
                Validations = ValidationKinds.All & ~ValidationKinds.ThrowOnUndeclaredPropertyForNonOpenType;
                this.ReadUntypedAsString = false;
                this.MaxProtocolVersion  = odataVersion;
            }
        }
Exemple #2
0
 /// <summary>Initializes a new instance of the <see cref="T:Microsoft.OData.ODataMessageReaderSettings" /> class
 /// with default values.</summary>
 public ODataMessageReaderSettings()
 {
     this.ClientCustomTypeResolver      = null;
     this.EnablePrimitiveTypeConversion = true;
     this.EnableMessageStreamDisposal   = true;
     this.EnableCharactersCheck         = false;
     this.MaxProtocolVersion            = ODataConstants.ODataDefaultProtocolVersion;
     Validations = ValidationKinds.All;
     Validator   = new ReaderValidator(this);
 }