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?

Reply via email to