WCF WebApi Enabling OData query support - odata

I followed Getting started with WCF Web API.
Everything works well and it supports some of the operators like
?$filter=Name eq 'Ajay'
?$top=4
But when I try other queries like
$filter=substringof('Ajay', Name)
OR
$filter=length(Name) gt 5
It gives following error
The server encountered an error processing the request. See server logs for more details.
But same queries work well with other ODATA services like Netflix. Does WCF Web API support only a limited set of queries, or I am missing something?

Yes preview 4 only supports a subset of the OData query options. However, there is a new Preview 5 available as of last week and it has additional OData support. I'm not sure if all of the query options are now supported but it is worth checking out.

Related

Querying OData api from Redux

I have a Web API using OData that I need to query. The client application is a SPA built with React/Redux, but it looks as if most data service libraries such as isomorphic-fetch do not support OData. Can BreezeJS be useful for me in this situation? Or OLingo's ODataJs? Any examples, tutorials, resources on using these or any other OData clients with Redux? AFAIK, I just need a the client library to query an OData source and support promises. And as far as the data I get back from the server, I just need simple json objects; no need for models that support binding.
I've seen discussions of Breeze + Angular/Backbone, but can it support Redux/React?
I doubt that either Breeze or ODataJS supports ES6, so if i had to wrap them in a ES6 module, would they still function properly?
Maybe it helps if you consider that OData isn't that far off from REST. If it's just about pulling the data from a OData service, you won't need much more than jQuery.getJSON and Breeze will work too. However, if you want to do it the fancy way, and want you app to introspect the meta-model and such, you should have a look at datajs or olingo.

sample app to illustrate use of OData in NancyFx

I am developing a sample app to illustrate use of OData in my application(NancyFx based).
Can any one help in get started with this.
First, I'm not familiar with NanchFx. As far as I know, it is a different framework to build Web application than Web API.
Second, what do you mean a "sample app" ? Is that a app to build an OData service or to consume a OData service? If it's for server side, maybe you need to get started with ODataLib. If it's for consuming, then maybe a little bit more options like OData client for .NET, OData client code generator, and other JavaScript library supporting OData like JayData, Olingo ODataJS, Breeze, etc. HTH

OpenUI5 Support for OData v4?

I was trying to use OpenUI5 with a .NET OData v4 Web API service. It looks like the client embeds the "Max OData Service Version" header with the HTTP request by default and my service doesn't like that. Additionally, documentation notes support for v2 experimental v3.
Does anyone know when support for v4 is expected?
Thanks so much!
There are people working on the v4 support, but don't expect it to be available in the next few months.
Currently a new version of the v2 model is being implemented that has performance optimizations and better batch support, after that one is finished I guess the v4 support will be an important part of the agenda.
OData V4 finaly just got released.
https://sapui5.netweaver.ondemand.com/sdk#docs/api/symbols/sap.ui.model.odata.v4.ODataModel.html
But keep in mind what Jens Ittel said:
[...] Due to its limited feature scope, we will not recommend to use
the first of these releases of the model implementation for productive
usage. [...]

Breeze: $expand not working with breeze/web api2

We migrated to webapi 2 and $expand is not working anymore on collections. We are using NHibernate with breeze 1.4.7.
When we try to expand a collection, it simply returns an empty array. The odd part is that the generated sql follows the usage of the expand keyword.
The same code is working as expected with web api v1
Is it a bug in the web api 2 version of breeze?
This is a bug. MS changed some of the OData handling in WebApi 2, and our NH support didn't change with it.
The fix is in 1.4.8 (expected to be out tomorrow). We apologize for the inconvenience.

Access Windows Search index using ASP.NET MVC

I'm on a project that is being upgraded from vbscript to ASP.NET MVC. It used Microsoft Index Server to index Word and PDF files on a Windows Server 2003 machine. It simply opened an OleDbConnection using a connection string like "Provider=\"MSIDXS\";Data Source=\"docSearch\";".
After researching a bit, I learned that Index Server is obsolete ("Note Indexing Service is obsolete as of Windows XP. Instead, use Windows Search." - http://msdn.microsoft.com/en-us/library/ms690580) and Windows Search is the successor.
So, in my new MVC app, I'm trying to connect using OleDbConnection with a connection string like "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"".
I have a method that takes in a formatted query and executes the search - here is the query that gets executed using OleDb:
string.Format("SELECT System.FileName FROM SystemIndex WHERE CONTAINS('{0}')", query)
Now, when I call my method in a test class, it works fine (i.e. returns results... myDataReader.HasRows is true). But, when I call the same method from my MVC Controller, it returns no results - myDataReader.HasRows is false - using the same query. My guess is something to do with permissions and IIS not being able to access the index. How can I get IIS to have access to the index? How can I expose the index to a ASP.NET web page? If Index Server is obsolete, and this functionality isn't supported in Windows Search, what am I supposed to use?
I would not change just because it is not supported unless you are having a specific problem with Indexing Service or need a feature from the newer version.
I would get connection string from ISearchQueryHelper
Does the service have the correct permissions? Have you checked the Windows Search 3.0/4.0 SDK?
I see you are on the forum (http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/7b9eead4-d938-42c6-ba2b-2c238a7706f9)
I am not sure Windows Search can really replace Indexing Service for Web sites. For instance, there is only one index called "SystemIndex" which contains everything on the local system. Therefore, how would you limit the results to just a Web site?
I believe you need to use "enterprise search" or "search server", which I have no experience with.
Since the results for both Indexing Service and Windows Search are ADO.NET, the presentation does not change much. The API is different enough that you will need to make many changes. For instance, there is no "scope" in Windows Search. When I changed over my personal "desktop search" application, it took an hour to make the change, but two days to duplicate all the functionality that I had with Indexing Service because of the API changes. I made this change because Windows Search is better when searching for code snippets in my "Code Library"
For standard queries with no regular-expressions or wild-cards or non-standard properties, both perform the same. Indexing Service always retrieves data quicker, but may not perform some queries that are "too expensive". Windows Search can take a long time retrieving the data depending on the query. Typically, these "long queries" are the "too expensive" queries of Indexing Service. "Long queries" can also result from any query that retrieves a property that is not contained in the index.
I am still using Indexing Service for my web sites on Windows Server 2003 and do not plan to make any changes because it is not as easy as I expected and there is no compelling reason to do.
I found my answer here ASP.NET OLEDB code breaks when deployed on IIS7. By impersonating a user that has access to the index.

Resources