Oops, I missed that expression. I'll add it.
Also, I don't think it need to replace the existing criterias - it could live along side them.
Richard -------------------------------------------------- From: "Ingo" <[email protected]> Sent: Friday, February 27, 2009 7:02 PM To: "nhibernate-development" <[email protected]> Subject: [nhibernate-development] Re: Type safe criteria
I agree with you. This is so much better when creating criterias. However, I have an example that I don't think the current version can handle (to my knowledge anyway) ICriteria criteria = Session.CreateCriteria(typeof(UserInRole)) .Add(Expression.Eq ("ApplicationName", applicationName)) .Add(Expression.Eq("RoleName", roleName)) .Add(Expression.InsensitiveLike ("UserName", userToMatch, MatchMode.Anywhere)); I think it has to be polished a bit before it can completely replace the traditional criterias. /Ingo On 8 Jan, 10:52, "Ayende Rahien" <[email protected]> wrote:This is really interesting: http://nhforge.org/blogs/nhibernate/archive/2009/01/07/typesafe-icrit... Expanding the syntax a bit, we can use: session.CreateCriteria<Person>() .SetFetchMode(p => p.PersonDetail, FetchMode.Eager) .SetLockMode(LockMode.Upgrade) .Add(p=>p.Name.Like("foo")) .List(); That would remove a lot of the pressure to build a full fledged linq provider. And it seems like it is much easier to do. Thoughts?
