示例#1
0
        internal RestOptions()
        {
            EnumerableChunkedSupport = true;

            FaultDetail = FaultDetail.DetailedInDebugMode;

            JsonSettings = new JsonFormatterSettings();
            XmlSettings = new XmlFormatterSettings();
            ODataSettings = new ODataSettings();

            BeginRequestAction = context => { };
            EndRequestAction = context => { };
            ExceptionAction = (context, Exception) => { };
        }
示例#2
0
        /// <summary>
        /// Sets custom OData operation settings.
        /// </summary>
        /// <param name="builder">The OData operation settings builder.</param>
        /// <returns>The configuration options object.</returns>
        public RestOptions WithODataSettings(Action<ODataSettings> builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            var settings = new ODataSettings();
            builder(settings);

            if (settings.MaxResults < 0)
            {
                settings.MaxResults = 0;
            }

            if (settings.CaseInsensitiveStringComparison)
            {
                ParserSettings.InsensitiveCaseComparison = true;
            }

            if (settings.InvariantCultureCaseConversion)
            {
                ParserSettings.InvariantCaseConversion = true;
            }

            ODataSettings = settings;
            return this;
        }