Linq project added to core

"Will Shaver" <[email protected]> Tue, 12 Aug 2008 22:02:12 -0700
Newsgroups gmane.comp.windows.dotnet.nhibernate.devel
Message-ID <[email protected]>
It looks like Chad Lee added the NHibernate.Linq project and
NHibernate.Linq.Test projects to the vs2008 solution. Cool.

I spent a few hours tonight going over Linq to NH project and Reflecting
over Linq to SQL. (What a mess that is.)

If none of you have read this article here:
http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx

It seems like a good place to start learning linq.

So the current implementation of linq to NH (contrib) appears to do this:
(please correct if I'm wrong)

NHibernateQueryProvider->Execute(Expression)
 //clean expression, translate nodes to NHibernateExpression type where
needed
 //visit all expression creating and appending to an ICriteria for each part
of the query.
 //execute the ICriteria

Easy enough. We're doing something a bit more complicated this time
around...


NHibernateQueryProvider-> Execute(Expression expression)
   //clean expression tree, translate nodes to NHibernateExpression type
where needed. ***
   //this translation is done by consulting the using the SessionFactory for
metadata on each item in the expression

option1:
   //Translate NHExpression to SqlString here?
   //Pass SqlString to Dialect for translation  (Things like
factory.Dialect.GetLimitString(sql string))

option2:
  //Pass NHExpression to the Dialect for limit strings ect,
public virtual SqlString GetLimitString(SqlString querySqlString, boolhasOffset)
  becomes
public virtual NHibernateExpression ProcessLimitString(NHibernateExpression
expression)
Which our translator calls to add in that dialect's specific limit string
and other quirks.

  //Then take the SqlString and process into entities and return as done in
Loader... Or put processing of the NHibernateExpression in Loader?

Let me know what you folks think.

***Linq To SQL appears to translate to a different tree type that is not
inherited from Expression, but contains an Expression property. Perhaps
there is a good reason for this? Review SqlNode in
System.Data.Linq.SqlClient via Reflector. Ironically they also have a direct
copy and paste of the internal marked ExpressionVisitor class in here as
well...

 -Will

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development