Suppose I have following tables with the right relationships built:
Employee(empID, ...)
Address(AddresID, ...)
EmployeeAddress(EmpID, AddressID, ...)
Then modified the generated code for GetEmployee by .NET RIA Services like:
public IQueryable<Employee> GetEmployee()
{
var Employee = this.Context.Employee.Include("EmployeeAddress").Include("Address");
return Employee;
}
Attribute [Include] has been added for EmployeeAddress in Employee and Address in EmployeeAddress.
When running the code at silverlight client side with following code:
EntityQuery<Employee> query = from e in ctx.GetEmployeeQuery()
select e;
I got nothing. If I remove the include from GetEmployee, like:
public IQueryable<Employee> GetEmployee()
{
var Employee = this.Context.Employee;
return Employee;
}
It works fine.
For lookup member in Employee, like Gender
public IQueryable<Employee> GetEmployee()
{
var Employee = this.Context.Employee.Include("GenderLookup");
return Employee;
}
It works fine. Here Employee.Gender is a single object. Is it because Employee.EmployeeAddress is a collection, not a single object?
Can't figure out the reason. How to resolve it?