I really wasn't happy with the way you need to break up the method chain to do certain joins, and while writing the release post last night an alternative occurred to me, which I have just spiked and liked:

[sourcecode language="csharp"]dynamic manager; // To hold the aliased reference var q = db.Employees.Query()
.Join(
db.Employees.As("Manager"), out manager).On(manager.Id  db.Employees.ManagerId) .Select(db.Employees.Name, manager.Name.As("Manager"));[/sourcecode]

This requires a variable to be declared ahead of the query, which gets passed as an out parameter to the Join method and receives the aliased ObjectReference. That variable can then be used for that reference throughout the rest of the query. It's still a compromise, but I think it's a better one.

It still works with named parameter syntax, but because runtime "magic" methods don't support out parameters in .NET 4, I've had to shunt the named parameters into an overload of the On method:

[sourcecode language="csharp"]dynamic manager; // To hold the aliased reference var q = db.Employees.Query()
.Join(
db.Employees.As("Manager"), out manager).On(manager.Id db.Employees.ManagerId) .Select(db.Employees.Name, manager.Name.As("Manager"));[/sourcecode]

I don't know about you, but I occasionally release a piece of software into production and then, next time I look at the code, think of a better way of achieving something. The nice thing about having good test coverage is that you can make those changes and be confident that what you've done hasn't broken anything.

Anyway, this syntax will be in 0.6.9, along with the Having clause support.