[CSHARP-612] Generic query builder throws exception when Injected using LINQ Created: 24/Oct/12 Updated: 20/Mar/14 Resolved: 04/Nov/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Zaid Masud | Assignee: | Craig Wilson |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | linq | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
The following exception is thrown when this unit test is run: System.ArgumentException : Unsupported where clause: LinqToMongo.Inject... This is true for pretty much any Inject done using generic query builder. Note that the non-generic query builder (where field name is specified as magic string) works fine. |
| Comments |
| Comment by Zaid Masud [ 06/Nov/12 ] | ||||||
|
Thanks for demonstrating the workaround, I suppose the important thing is that it's documented here so it could be of help to others. A Google search on "generic inject exception C# mongodb" shows this ticket as the first result so hopefully others will find it useful! | ||||||
| Comment by Craig Wilson [ 04/Nov/12 ] | ||||||
|
We have decided not to fix this. Other than it getting really tricky, there is a simple workaround and embedding this type of thing in the query doesn't make a lot of sense. A majority of the typed query builder's functions can be done natively with Linq. For those few operations that can't, then they can always be expressed prior to the query and injected in. As self-document comparisons aren't allowed (doc.A == doc.B), then there is no need to have a reference to anything else in the query.
If you have a compelling reason this is necessary, please feel free to comment and we can revisit the issue. | ||||||
| Comment by Craig Wilson [ 04/Nov/12 ] | ||||||
|
In code review... |