When you work in an Open Source project, in how many hours a blog post, about a limitation, can become obsolete ?
This
var criteria = session.CreateCriteria(typeof(Person))
.Add(Restrictions
.And(Restrictions.Eq("Name", "Richard"),
Restrictions.Or(Restrictions.Gt("Age", 21),
Restrictions.Eq("HasCar", true))));
in NH3.0.0 will look
var query = session.QueryOver<Person>()
.Where(p => p.Name == "Richard" && (p.Age > 21 || p.HasCar));
well… the answer to the above question is : in few hours.
Thanks Richard.
P.S. perhaps now I can reconsider my opinion about Criteria readability.
This comment has been removed by the author.
ReplyDeleteIt sounds as the same as http://code.google.com/p/nhlambdaextensions/
ReplyDelete@cprieto
ReplyDeletedid you read the linked previous post ?
Richard Brown is the nhlambdaextensions project leader and now he is a NH-Core committer.
In practice nhlambdaextensions will be full imported and improved in NH3.0.0.
yeah, thats fast progress ;)
ReplyDeletewhen nh3.0.0 will get released we have the option of lambda criterias and nhibernate to linq, right? under wich circumstances would one chose which option?
I don't know exactly which options we will release in NH3.0.0; for sure you will have more than two to query your domain.
ReplyDeleteHow would an ICriteria with multiple level or statements look like?
ReplyDeleteThat is, given this HQL:
from Company c
left join c.Manager manager
where c.Name like 'Oracle' or manager.Name like 'Tomas'
How will it look like?
@Darius
ReplyDeleteWe are working on it; Richard more than me (so far I'm helping him only by talking).
About "substitution" : even linq2nh will have some problem to substitute HQL at all. HQL is not so general purpose, HQL was thought to have a powerful query language to query entities-domain.
Deam!, NH is being updated faster than I can absorbe the news. You're giving us too much new things to play with.
ReplyDeleteThanks Fabio and all the team for these improvements!
@Diego
ReplyDeleteFor sure, you will the one known from where come some QueryOver syntax... a pending work is becoming a reality in NH-Core.
Thanks Fabio for answer.
ReplyDeleteToday i will be giving a short presentation on NHibernate in Lithuanian .Net user group meeting, so i will spread the good news ;)
@Fabio
ReplyDeleteCool, I really love the work in NHLambda, great to see it included in NHibernate Core now :D
Included and improved :D
ReplyDelete