If you are going to use the reflection provider, you will need to employ a couple of tricks to make it work. This is an issue with how WCF Data Services interacts with an object model. You can read about this here:
.
Alternatively, I have written a project that handles this for you already here:
https://github.com/craiggwilson/mongo-dotnet-odata. I'm still working on Update support. It is mostly finished, I just haven't finished getting it fully tested, so you can pull the source. If you don't need updating, just go to nuget and pull down MongoDB.OData.
On Tuesday, October 2, 2012 3:04:28 PM UTC-5, Greg Vazzana wrote:
Hi,
I am trying to hook up a Mongo back-end to expose OData via WCF Data Services. For some reason when I run a query through the service such as:
http://localhost/odata/MyData()?$filter=substringof('New',Name)
An exception is thrown. I have tracked it down to
protected virtual Expression VisitConditional(ConditionalExpression node) in ExpressionVisitor.cs where data types do not match because one size of the conditional is Boolean and the other is Nullable<Boolean>.
According to the debugger this is the expression getting processed:
.If ($it.Name == null) {
null
} .Else {
(System.Nullable`1[System.Boolean]).Call ($it.Name).Contains("New")
}
Anyone have any thoughts?
Thanks,