Hi,
I wonder if someone could assist me solving this particular problem I have been having. I believe the following code should work but I get the error posted underneath the code sample:
var result = from l in context.TodoList
orderby l.Position ascending, l.CreatedOn descending
select new TodoListSummary
{
Id = l.Id,
Title = l.Title,
Description = l.Description,
Position = l.Position,
CreatedOn = l.CreatedOn,
Tasks = from t in l.Todos
select new TaskSummary
{
Id = t.Id,
Title = t.Title,
Position = t.Position,
CreatedOn = t.CreatedOn,
Completed = t.Completed == 1,
CompletedDate = t.CompletedDate,
Company = t.Company,
User = t.User,
TimeSpentInMinutes = t.Timeentries.Sum(y => y.TimeInMinutes),
CommentCount = t.Comments.Count()
}
};
Error:
The multi-part identifier "LPLA_3.id" could not be bound.
The multi-part identifier "LPLA_3.name" could not be bound.
The multi-part identifier "LPLA_4.userID" could not be bound.
The multi-part identifier "LPLA_4.firstname" could not be bound.
The multi-part identifier "LPLA_4.lastname" could not be bound.
The multi-part identifier "LPLA_4.fullname" could not be bound.
The multi-part identifier "LPLA_4.email" could not be bound.
The multi-part identifier "LPLA_4.companyId" could not be bound.
The multi-part identifier "LPLA_4.createdOn" could not be bound.
The multi-part identifier "LPLA_4.createdBy" could not be bound.
The multi-part identifier "LPLA_4.modifiedOn" could not be bound.
The multi-part identifier "LPLA_4.modifiedBy" could not be bound.
The multi-part identifier "LPLA_4.createdUserId" could not be bound.
The multi-part identifier "LPLA_4.modifiedUserId" could not be bound.
Essentially it is failing to include t.Company and t.User entities in the query it is producing. The strange thing is that if I rewrite the query such that anonymous types are used it works.
var result = from l in context.TodoList
orderby l.Position ascending, l.CreatedOn descending
select new
{
Id = l.Id,
Title = l.Title,
Description = l.Description,
Position = l.Position,
CreatedOn = l.CreatedOn,
Tasks = from t in l.Todos
select new
{
Id = t.Id,
Title = t.Title,
Position = t.Position,
CreatedOn = t.CreatedOn,
Completed = t.Completed == 1,
CompletedDate = t.CompletedDate,
Company = t.Company,
User = t.User,
TimeSpentInMinutes = t.Timeentries.Sum(y => y.TimeInMinutes),
CommentCount = t.Comments.Count()
}
};
I recently upgraded the runtime libraries to build 12242009. I am obviously using LLBLGEN Pro 2.6.
I find this issue even more strange considering the following from the help documentation:
Storing an entity in an anonymous type field isn't supported, as the entity itself isn't materialized so it's not storable as a value inside the anonymous object.
Any help would be greatly appreciated.
Regards,
Rohland