Results so far I've put on CodeProject:
- http://www.codeproject.com/KB/linq/SqlLinq.aspx
- http://www.codeproject.com/KB/linq/QueryAnything.aspx
So just now I've been able to get this unit test to pass:
[TestMethod]
public void SimpleJoin()
{
IEnumerable source<Person> = TestData.GetPeople();
IEnumerable families<Family> = TestData.GetFamilies();
var answer = source.Join(families, p => p.Address, f => f.Address,
(p, f) => new FamilyMember { Name = p.Name, LastName = f.Name, Location = f.Address });
var result = source.Query<Person, Family, FamilyMember>
("SELECT Name, that.Name AS LastName, Address AS Location
FROM this INNER JOIN that ON this.Address = that.Address", families);
Assert.IsTrue(result.SequenceEqual(answer));
}This is cool because now I can start generating complex queries without having compile time knowledge of the underlying data structures. Once I get things fleshed out further I'll update things on CodeProject.
CodeProject
No comments:
Post a Comment