QueryDescriptor and Navigation Properties

Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
William MaryMember

Should the querdescriptor work if we drill down through the navigation properties. For example:

 I have a schemawith a many to many relationship.

EMPLOYEE-TABLE             CLIENT-TABLE

EmployeeID          *----* ClientID

FullName                          ClientName

 

So the Employee Entity should be:

_____________

| EmployeeID |

| FullName     |

|----------|

| Clients         |

_____________

 

I should be able to write a query (Assuming intersoft style viewmodels for a grid) as such:

QueryDescriptor qd = _employeeViewModel.QueryDescriptor;
CompositeFilterDescriptorCollection employeeFilter = new CompositeFilterDescriptorCollection();
 
employeeFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
 
employeeFilter.Add(
                    new FilterDescriptor()
                    {
                        PropertyName = "Clients.ClientID",
                        Operator = FilterOperator.IsEqualTo,
                        Value = 1
                    }
                    );
 
qd.FilterDescriptors.LogicalOperator = FilterCompositionLogicalOperator.Or;
qd.FilterDescriptors.Add(employeeFilter);
 
It does not work and gives me a null reference exception. I am assuming it is because of the dependancy property being across a navigation property of the entity. Is there a way to accoplish this type of query. Right now I have to avaid using the query descriptor and accoplish this in the repository with a getdata method that accepts the ID to pass to linq.
All times are GMT -5. The time now is 1:22 PM.
Previous Next