Hi all,
I've got a problem with Linq in VB.NET. I've created a .dbml file from my db, and everything looks good - relation "arrows" between tables are visible, etc.
But when I want to use simple query (taken from 101 Linq Samples by MS):
Dim q = From h In dc.Hours, w In h.WorkType
I receive an error:
Expression of type 'INTegrity.WorkType' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.
h.Worktype is visible in Intellisense...
I can manually join in the Linq query, but shouldn't the relations be automatic?
The full query that works, but using "manual joins" looks like this:
Dim q1 = From g In dc1.Hours _
Join pr In dc1.WorkType On g.WorkTypeId Equals pr.WorkTypeId _
Where g.WorkerId = workerid _
Select New With {g.EntryId, g.Date, pr.WorkTypeDesc, g.Minutes}
Worktype table has 1 to many relationship with Hours table (as you can see on the WorkTypeId column)