I'm trying to write a simple query that requires an alias as it's a Many-To-Many assocation however I can't get it to work with NH Lambda Extensions. It always gives me a compile error even though as far as I can tell it's exactly the same as the documentation and all the examples I've seen online.
Works
var query = DetachedCriteria.For<County>()
.CreateCriteria("Zips", "zipAlias", JoinType.LeftOuterJoin)
//.CreateCriteria<County>(x => x.Zips,
// () => zipAlias, JoinType.LeftOuterJoin)
.Add<Zip>(zip => zip.ZipCode == zipCode);
Doesn't work
var query = DetachedCriteria.For<County>()
//.CreateCriteria("Zips", "zipAlias", JoinType.LeftOuterJoin)
.CreateCriteria<County>(x => x.Zips,
() => zipAlias, JoinType.LeftOuterJoin)
.Add<Zip>(zip => zip.ZipCode == zipCode);
Results in a build Error 22 The name 'zipAlias' does not exist in the current context
Intellisense also highlights the CreateCriteria*<County>
* saying it doesn't understand the method however it does correctly show me the parameter names when I'm inside the parens.