Esempio n. 1
0
        public virtual async Task <IHttpActionResult> Search(ODataQueryOptions <E> request)
        {
            try
            {
                //Validate that the request is correctly formed.
                request.Validate(mODataValidate);

                //Load the request with the necessary parameters.
                SearchRequest rq = new SearchRequest();
                rq.ODataPopulate(request);

                //Make the request to the persistence service.
                RepositorySettings settings = ApiUtility.BuildRepositorySettings(ActionContext);
                RepositoryHolder <SearchRequest, SearchResponse> response = await mRespository.Search(rq, settings);

                return(new OData4ServiceDocumentResponse(response, ActionContext.Request.RequestUri));
            }
            catch (Exception vex)
            {
                return(BadRequest($"Unable to process Odata request - {vex.Message}"));
            }
        }