This is a migrated thread and some comments may be shown as answers.

Specifying dictionary key in the WHERE clause

1 Answer 74 Views
OQL (OQL specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James Denning
Top achievements
Rank 1
James Denning asked on 30 Nov 2009, 05:14 PM
Hi
What is the syntax in OQL to query on the value of a key of a dictionary that belongs to a parent class. Say I have a Person class with a dictionary<string,Address> Addresses where Address is a persisted class. What would be the correct OQL for "select * from PersonExtent as P where P.Addresses['Home'] != null"?
Thanks
James Denning

1 Answer, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 03 Dec 2009, 05:23 PM
Hello James Denning,

Unfortunately that is not possible using OQL. I would suggest you to use LINQ as a workaround. So for example if you have a class called persons that has a dictionary property called dict a query that would be accessing the dictionary keys would look something similar to that:
var result = from c in scope.Extent<Person>()
                        from f in c.Dict.Keys
                        where f == 1
                        select c;


Best wishes,
Petar
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
OQL (OQL specific questions)
Asked by
James Denning
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or