Linq to NHibernate Progress Report

Just done another commit to the trunk with a bit more functionality working. Here's a couple of tests that now pass:

var q = from c in db.Customers
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId
select new { c.ContactName, o.OrderId };

var q = from c in db.Customers
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId into ords
join e in db.Employees on c.Address.City equals e.Address.City into emps
select new {c.ContactName, ords = ords.Count(), emps = emps.Count()};

var q = from c in db.Customers
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId into orders
select new {c.ContactName, OrderCount = orders.Average(x => x.Freight)};

As before, I'm just working to get the tests passing and it currently wouldn't be hard to get variations of these to fail; for example, I don't yet handle joins on compound keys. However, also as before, I'm getting more confident with the structure and things seem to be moving along nicely.
Next steps are to look at parameterization and polymorphism - the Linq side of things actually does pretty much everything it does here, the changes I need to do are within the HQL parsing subsystem. They shouldn't be hard, so I'm hoping to get them nailed quite quickly. Oh yeah, also need to get some Asserts into the tests. Right now, they are a pretty fragile safety net :) I know how to do this now in a fairly simple way, so this should also be simple.

Comments

# re: Linq to NHibernate Progress Report
Gravatar Hi Steve,

I've been playing around with your linq provider attempting to implement minor features to learn a bit more about expression trees. So far I've managed to implement Contains and Equals functions fairly easily, but I can't seem to figure out ToLower() or ToUpper().

I'm not really planning on providing patches as I think these things would be rather easy for you to implement. However, if you could give me a pointer on ToLower I'd appreciate it.

Also, the NHibernate project is _massive_ and builds rather slowly, I find myself not being able to expirement well because it's so slow to build/run tests whenever I've changed something. Is there any known way of speeding this up?

Anyway, thanks for all your hard work.
Left by justin on 9/26/2009 5:04 AM
# Reflective Perspective - Chris Alcock » The Morning Brew #442
Gravatar Reflective Perspective - Chris Alcock » The Morning Brew #442
Left by Pingback/TrackBack on 9/28/2009 9:38 AM
# re: Linq to NHibernate Progress Report
Gravatar Great work Steve....looking forward to more progress.
Left by Eric Swann on 9/28/2009 6:20 PM
# re: Linq to NHibernate Progress Report
Gravatar Fantastic progress!

Linq2Hibernate is something really needed so im sure that anyone working with NHibernate is closely looking to what you are doing.

In other words, keep up the good work!
Left by Roboblob on 9/29/2009 9:00 AM
# re: Linq to NHibernate Progress Report
Gravatar Good stuff Steve
Left by James L on 9/30/2009 10:25 AM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

Please add 8 and 8 and type the answer here:

Preview Your Comment.