-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query conditions on linked properties #806
Comments
That would be really great |
is there any ETA for that? It seems that all other platforms already have that feature. Any design so we could help with an implementation? |
That's what we are actually using since mid-Feb: https://github.com/Shaddix/realm-dotnet The syntax (as well as implementation, actually) was ported from realm-java: It's currently looks like a hack, rather than proper implementation, but it's much better than living without link queries. Here's the usage example: I do understand, that proper implementation via LINQ is much more complex (i.e. will not be available coming months), so the solution like that could be helpful (at least for those who are eager for LinkQuery functionality) |
I tried to workaround this with r.All<Dog>().Where(dog =>
r.All<Person>().Any(person =>
person.FirstName == "John" && person == dog.Owner)) but get the error
|
This is not supported - there's no way to express the condition as a query that will get executed by the database. Instead, you can use the var dogs = r.All<Dog>().Filter("Owner.FirstName == 'John'"); You can read up more on the syntax here: https://realm.io/docs/javascript/latest/api/tutorial-query-language.html. This page is covering the JS SDK, so you won't be able to just copy-paste the examples in a .NET app, but the syntax itself is identical. The .NET docs are being updated and we hope to have that functionality covered soon. |
Any update on when there would be an update that fixes this and gives us a solution that the OP asked for? |
We've put some work toward that, but we don't have a timeline for when that will be complete and released. |
This has come up multiple times in our project in a way that degrades code legibility by having to use the raw |
Is there any update on this? It is really hard to believe that this is not a thing already. It's been so long since this issue was opened. |
I agree - it's not ideal, but we haven't been able to prioritize it higher because the team has been focused on more important features for which there is no workaround. While using raw string queries is not as nice as using LINQ, it's at least an option and if LINQ support is absolutely critical, you could write an expression visitor that converts a LINQ expression into an RQL string and pass that to Realm. If this turns into a well designed and tested project, we'd be happy to accept it as a contribution to the Realm SDK. |
So you can filter by, say,
r.All<Dog>().Where(dog => dog.Owner.FirstName == "John")
The text was updated successfully, but these errors were encountered: