How does NHibernate 3 resolve the QueryOver <> syntax?

I am wondering how the NHibernate team solved the QueryOver syntax so that it works with intellisense and validation at compile time?

According to http://nhforge.org/blogs/nhibernate/archive/2009/12/17/queryover-in-nh-3-0.aspx , they use extension methods and lambda expressions, but I tried to look at the source, but it Don't I really fully explain this to me.

How do they make them type safe at compile time without the need for any proxy classes?

I would like to “copy” this behavior, but for this I need some basic understanding of the concept, any links to documentation on this subject are also welcome.

+3
source share
1 answer

Like any LINQ implementation, QueryOver uses expression trees at run time. In particular, see the ExpressionProcessor class, it has a dictionary that displays expressions for functions that use ICriteria.

QueryOver . , OrderBy IQueryOverOrderBuilder, , . , IQueryOverRestrictionBuilder, . , this, .

+4

Source: https://habr.com/ru/post/1756896/


All Articles