Пример #1
0
        public static ODataQueryOptions CreateOptionsFromQueryString(this ODataQueryContext context, IDictionary <string, string> queryString)
        {
            //Create request
            var url = "http://autoPocoInternalOdata.com/site?";

            foreach (var param in queryString)
            {
                url += param.Key + "=" + param.Value + "&";
            }
            url = url.Trim('?').Trim('&');

            Uri uri    = new Uri(url);
            var config = new System.Web.Http.HttpConfiguration();

            config.EnableDependencyInjection();
            config.Count().Filter().OrderBy().Expand().Select().MaxTop(1000);

            var request = new HttpRequestMessage
            {
                RequestUri = uri
            };

            request.SetConfiguration(config);

            return(new ODataQueryOptions(context, request));
        }
Пример #2
0
        public static ODataConventionModelBuilder ConfigureConventionBuilder()
        {
            var config = new System.Web.Http.HttpConfiguration();

            config.EnableDependencyInjection();
            config.Count().Filter().OrderBy().Expand().Select().MaxTop(1000);

            var modelBuilder = new ODataConventionModelBuilder(config, true);

            return(modelBuilder);
        }