I am using ES 2007.1.1210 and MyGeneration 1.2.0.7.
Let's say I have two tables, Employee and JobTitle.
Employee has columns PKEmployeeID, Name, and FKJobTitleID. FKJobTitleID is nullable.
JobTitle has columsn PKJobTitleID, Name.
There is a relationship between the two table via the JobTitleID fields.
I am binding a DetailsView at runtime to a query with the following code:
Code:
EmployeeCollection emps = new EmployeeCollection();
EmployeeQuery eq = new EmployeeQuery("eq");
JobTitleQuery jq = new JobTitleQuery("jq");
eq.Select(eq.PKEmployeeID, eq.Name, jq.Name.As("JobName"));
eq.LeftJoin(jq).On(eq.FKJobTitleID == jq.PKJobTitleID);
eq.Where(eq.PKEmployeeID == 42);
if (emps.Load(eq))
{
DetailsView1.DataSource = emps.LowLevelBind();
DetailsView1.DataBind();
} This works if Employee.FKJobTitleID is not null but not when it is null.
The problem is that there is no property made for JobName when FKJobTitleID is null, though the SQL does return a null value for it.