Hi!
Is there a way to filter item's of the complex type in RadDataFilter?
I know that fIlter works fine with simple entity classes like that:
So I can request from a database some filtered data like that:
And it returns me the data that matches my filter. For example, all ClassA items, where Count > 5.
But I can't find out a way to do that with complex types. Here is one example:
Is there a way to filter item's of the complex type in RadDataFilter?
I know that fIlter works fine with simple entity classes like that:
public
enum
MyEnum {A, B, C};
public
class
ClassA
{
public
string
Name {
get
;
set
; }
public
int
Count {
get
;
set
; }
public
MyEnum Type {
get
;
set
; }
}
So I can request from a database some filtered data like that:
var filters =
new
CompositeFilterDescriptorCollection();
filters.AddRange(MyRadDataFilter.FilterDescriptors);
filters.LogicalOperator = MyRadDataFilter.LogicalOperator;
using
(var context =
new
DbContext())
{
var result = context.Set<ClassA>().Where(filters);
var data = result
as
IEnumerable<ClassA>;
return
data.ToList();
}
And it returns me the data that matches my filter. For example, all ClassA items, where Count > 5.
But I can't find out a way to do that with complex types. Here is one example:
public
class
AddressClass
{
public
string
Country {
get
;
set
; }
public
string
City {
get
;
set
; }
}
public
enum
GenderEnum { Male, Female };
public
class
Person
{
public
string
Name {
get
;
set
; }
public
int
Age {
get
;
set
; }
public
GenderEnum Gender {
get
;
set
; }
}
public
class
Doc
{
public
DateTime Date {
get
;
set
; }
public
string
Content {
get
;
set
; }
public
AddressClass Address {
get
;
set
; }
public
List<Person> Persons {
get
;
set
; }
}
So I have to load Doc's that mathes some filter like that :
All docs, where Address.City is NewYork
or
All docs in which there is a person older than 22 years.
And so I need to give users the ability to set the conditions in the filter.
How could I do?
I would be glad to get a working example project.
Hope to hear from you soon.
Thanks.