Ok, bear with me... hadn't done any Linq or Lambda until a couple of days ago :)
I'm using C# and the ADO.NET Entity Framework. I want to query my model and get back a List of objects based on a relationship.
Here's my code:
var query = db.Achievements.Join
(
db.AchievementOrganisations,
ach => ach.AchievementId,
ao => ao.AchievementId,
(ach, ao) => new { Achievement = ach }
);
var query2 = from s in db.Achievements
join h in db.AchievementOrganisations
on s.AchievementId equals h.AchievementId
select s;
(sorry about the formatting)
My question is why does the first query, which I believe is a Lambda Expression, return an Anonymous Type:
{System.Data.Objects.ObjectQuery<<>f__AnonymousType1<MyApp.Models.Achievement>>}
...but the second query (a LINQ query) I get a strongly-typed value back:
{System.Data.Objects.ObjectQuery<MyApp.Models.Achievement>}
Why is this?
Cheers,
Ben