Which NHibernate LINQ provider to use?

24 views
Skip to first unread message

Mohamed Meligy

unread,
Nov 4, 2009, 7:28:39 AM11/4/09
to nhu...@googlegroups.com
I have been using the NHibernate Contrib LINQ provider for a short while, then a friend told me that NHibernate trunk itself has another LINQ provider that he heard is better.

However, I see all the LINQ related questions here use the one from the NHibernate Contrib - ISession.Linq<>() not ISession.Query<>() - so, it gets me confused.

The question is:
Which NHIbernate LINQ provider is reocmmended to use - ISession.Linq<>() or ISession.Query<>() -, both short term (now) and long term?

Thank you very much,
Regards,

--
Mohamed Meligy
Information Analyst (.Net Technologies) – Applications Delivery - TDG
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: eng.m...@gmail.com
Weblog: http://weblogs.asp.net/meligy

Bill Barry

unread,
Nov 4, 2009, 9:56:41 AM11/4/09
to nhu...@googlegroups.com
Someone should correct me if I am wrong, but as I understand it, the trunk provider is the contrib version which has been merged into trunk. I think that chances are most people asking on this list are using the contrib version because they haven't updated trunk to the proper version yet (I know I haven't). I wouldn't plan to use either of them for a production app but rather figure out how to help Steve Strong get the new provider written. In the meantime I suppose it doesn't matter which one you choose to use. I would wrap it in a proxy class so that you can easily replace it when the time comes:

public class LinqProvider {
    ISession _session;
    public LinqProvider(ISession session) { _session=session;}
    public IQueryable<T> Query<T>() {return _session.Linq<T>(); } // or .Query
}

This could be a transient IoC provided object you may use, or you could do new LinqProvider(ISession).Query<Blog>()... every time you want to use it (though I would go a bit farther and implement an IQueryable repository class like this: http://www.codeinsanity.com/2008/08/implementing-repository-and.html because it makes a lot of sense to me).

Fabio Maulo

unread,
Nov 4, 2009, 10:15:13 AM11/4/09
to nhu...@googlegroups.com
The trunk LINQ prov. is a completely new provider based on HQL AST instead Criteria.
The trunk version is not ready for production.

2009/11/4 Bill Barry <after....@gmail.com>



--
Fabio Maulo

alberto rodriguez

unread,
Nov 4, 2009, 10:44:47 AM11/4/09
to nhusers
Just out of curiosity, then why is it in trunk instead of in a
separate branch? :)

On 4 nov, 16:15, Fabio Maulo <fabioma...@gmail.com> wrote:
> The trunk LINQ prov. is a completely new provider based on HQL AST instead
> Criteria.
> The trunk version is not ready for production.
>
> 2009/11/4 Bill Barry <after.fall...@gmail.com>
>
>
>
> >  Someone should correct me if I am wrong, but as I understand it, the trunk
> > provider is the contrib version which has been merged into trunk. I think
> > that chances are most people asking on this list are using the contrib
> > version because they haven't updated trunk to the proper version yet (I know
> > I haven't). I wouldn't plan to use either of them for a production app but
> > rather figure out how to help Steve Strong get the new provider written. In
> > the meantime I suppose it doesn't matter which one you choose to use. I
> > would wrap it in a proxy class so that you can easily replace it when the
> > time comes:
>
> > public class LinqProvider {
> >     ISession _session;
> >     public LinqProvider(ISession session) { _session=session;}
> >     public IQueryable<T> Query<T>() {return _session.Linq<T>(); } // or
> > .Query
> > }
>
> > This could be a transient IoC provided object you may use, or you could do
> > new LinqProvider(ISession).Query<Blog>()... every time you want to use it
> > (though I would go a bit farther and implement an IQueryable repository
> > class like this:
> >http://www.codeinsanity.com/2008/08/implementing-repository-and.htmlb...it makes a lot of sense to me).
>
> > Mohamed Meligy wrote:
>
> > I have been using the NHibernate Contrib LINQ provider for a short while,
> > then a friend told me that NHibernate trunk itself has another LINQ provider
> > that he heard is better.
>
> > However, I see all the LINQ related questions here use the one from the
> > NHibernate Contrib - ISession.Linq<>() not ISession.Query<>() - so, it
> > gets me confused.
>
> > The question is:
> > *Which NHIbernate LINQ provider is reocmmended to use *- ISession.Linq<>()or
> > ISession.Query<>() -*, both short term (now) and long term?*
>
> > Thank you very much,
> > Regards,
>
> > --
> > Mohamed Meligy
> > Information Analyst (.Net Technologies) – Applications Delivery - TDG
> > Injazat Data Systems
> > P.O. Box: 8230 Abu Dhabi, UAE.
>
> > Phone:  +971 2 6992700
> > Direct:   +971 2 4045385
> > Mobile:  +971 50 2623624, +971 55 2017 621
>
> > E-mail: eng.mel...@gmail.com

Fabio Maulo

unread,
Nov 4, 2009, 11:01:25 AM11/4/09
to nhu...@googlegroups.com
Just out of curiosity... why it should be in a branch instead trunk ?

2009/11/4 alberto rodriguez <albert...@gmail.com>



--
Fabio Maulo

alberto rodriguez

unread,
Nov 4, 2009, 6:37:39 PM11/4/09
to nhusers
Because then no one would be able to use it before it's ready.

On 4 nov, 17:01, Fabio Maulo <fabioma...@gmail.com> wrote:
> Just out of curiosity... why it should be in a branch instead trunk ?
>
> 2009/11/4 alberto rodriguez <alberto.em...@gmail.com>
> >http://www.codeinsanity.com/2008/08/implementing-repository-and.htmlb...a lot of sense to me).

Richard Brown (gmail)

unread,
Nov 5, 2009, 5:31:17 AM11/5/09
to nhusers
I don't think you can 'accidentally' use the trunk?

Features on the trunk are work-in-progress ... but are not meant to be
hidden away; people are welcome to 'kick their tyres'. (I think we just
wouldn't recommend them for production until they've been kicked a little
harder.)

--------------------------------------------------
From: "alberto rodriguez" <albert...@gmail.com>
Sent: Wednesday, November 04, 2009 11:37 PM
To: "nhusers" <nhu...@googlegroups.com>
Subject: [nhusers] Re: Which NHibernate LINQ provider to use?

Markus Zywitza

unread,
Nov 5, 2009, 6:20:15 AM11/5/09
to nhu...@googlegroups.com
There are differences between work-in-progress and a complete
redesign. During NH2.1 development, the NH trunk was perfectly usable
for production all the time. Now, I am not
sure of this anymore, when the LINQ implementation is not usable (at
least that is what I understood from Fabio's post).

This is equivalent to MonoRail's change to the IController. The
development took place in a separate branch until the IController was
stable enough to work in production and was then merged back to Castle
trunk.


-Markus

2009/11/5 Richard Brown (gmail) <fluk...@googlemail.com>:

Fabio Maulo

unread,
Nov 5, 2009, 6:59:40 AM11/5/09
to nhu...@googlegroups.com
You can use the trunk with the contrib-Linq.
If you have a problem doing it let us know.

2009/11/5 Markus Zywitza <markus....@gmail.com>



--
Fabio Maulo

Markus Zywitza

unread,
Nov 5, 2009, 7:34:05 AM11/5/09
to nhu...@googlegroups.com
Thanks for the clarification.

-Markus

2009/11/5 Fabio Maulo <fabio...@gmail.com>:

SteveG

unread,
Nov 5, 2009, 9:01:53 AM11/5/09
to nhusers
You might want to take a look at 're-linq' as well.

alberto rodriguez

unread,
Nov 7, 2009, 8:46:33 AM11/7/09
to nhusers
I answered your question. Will you answer my question now?

On 4 nov, 17:01, Fabio Maulo <fabioma...@gmail.com> wrote:
> Just out of curiosity... why it should be in a branch instead trunk ?
>
> 2009/11/4 alberto rodriguez <alberto.em...@gmail.com>
> >http://www.codeinsanity.com/2008/08/implementing-repository-and.htmlb...a lot of sense to me).

Fabio Maulo

unread,
Nov 7, 2009, 8:54:09 AM11/7/09
to nhu...@googlegroups.com
there are a lot using NH trunk compiling sources, or through Horn, or downloading from TeamCity...
"nobody can use it" is only your opinion.

2009/11/7 alberto rodriguez <albert...@gmail.com>



--
Fabio Maulo

alberto rodriguez

unread,
Nov 7, 2009, 9:27:23 AM11/7/09
to nhusers
What? I'm afraid I am lost. I asked why the new Linq implementation is
in the trunk since "it is not yet ready from production" yet, you
asked me for a reason to do so (not including it in the trunk) and I
gave you one. How is that related to the fact that many people compile
NH from sources?

On 7 nov, 14:54, Fabio Maulo <fabioma...@gmail.com> wrote:
> there are a lot using NH trunk compiling sources, or through Horn, or
> downloading from TeamCity...
> "nobody can use it" is only your opinion.
>
> 2009/11/7 alberto rodriguez <alberto.em...@gmail.com>
> >http://www.codeinsanity.com/2008/08/implementing-repository-and.htmlb...of sense to me).

Fabio Maulo

unread,
Nov 7, 2009, 9:46:13 AM11/7/09
to nhu...@googlegroups.com
cuanto tiempo queres que pierda contestandote eso ?

The TRUNK is the main development line; the new LINQ provider is one of the most important feature of NH3.0 and this is the reason because we have it in the main development line.

Where you heard that everything in the trunk is ready for production ?

If you don't like it there is a very simple solution:
Open a new branch in gitHub or where you want and maintain it as you want or pay somebody to do that work for you; we can't maintain more than 2 versions at the same time (this is a fact not an opinion).

If you are afraid using the trunk in production you can use one final release (the last, NH2.1.1GA, was released few days ago).

The NHibernate's team has strictly rules for commits in trunk: the trunk is always compilable and must pass all our existing tests (more than 2100) because the quality is not achieved by chance.

If you have another standard in your mind you can apply it in your team. 

Is it clear now? or you need some other explications ?

2009/11/7 alberto rodriguez <albert...@gmail.com>



--
Fabio Maulo

Wayne Douglas

unread,
Nov 7, 2009, 9:59:15 AM11/7/09
to nhu...@googlegroups.com
can i just add to this:

trunk was never "production" -  trunk is for active development of the main dev stream. a build release is branched from trunk and labelled - for release compilation and use in a production environment. but the trunk was never production.

if every new feature or bit of code meant branching and merging when ready - nothing would ever get built and would be completely pointless.
--
Cheers,

w://

Kim Johansson

unread,
Nov 7, 2009, 10:09:20 AM11/7/09
to nhu...@googlegroups.com
When discussing this... Is the trunk the future 3.0.0?

Wayne Douglas skrev:

alberto rodriguez

unread,
Nov 7, 2009, 10:13:18 AM11/7/09
to nhusers
I think you are getting overly defensive, so I'll leave it here. A
short "because managing multiple branches is too complicated for us"
would have been enough.

On 7 nov, 15:46, Fabio Maulo <fabioma...@gmail.com> wrote:
> cuanto tiempo queres que pierda contestandote eso ?
>
> The TRUNK is the main development line; the new LINQ provider is one of the
> most important feature of NH3.0 and this is the reason because we have it in
> the main development line.
>
> Where you heard that everything in the trunk is ready for production ?
>
> If you don't like it there is a very simple solution:
> Open a new branch in gitHub or where you want and maintain it as you want or
> pay somebody to do that work for you; we can't maintain more than 2 versions
> at the same time (this is a fact not an opinion).
>
> If you are afraid using the trunk in production you can use one final
> release (the last, NH2.1.1GA, was released few days ago).
>
> The NHibernate's team has strictly rules for commits in trunk: the trunk is
> always compilable and must pass all our existing tests (more than 2100)
> because the quality is not achieved by chance.
>
> If you have another standard in your mind you can apply it in your team.
>
> Is it clear now? or you need some other explications ?
>
> 2009/11/7 alberto rodriguez <alberto.em...@gmail.com>
> >http://www.codeinsanity.com/2008/08/implementing-repository-and.htmlb...to me).

Fabio Maulo

unread,
Nov 7, 2009, 10:23:17 AM11/7/09
to nhu...@googlegroups.com
we don't want manage each feature in a separate branch!

If you want understand how NH is working have a look to the SVN history after NH1.0.4.

Is not a matter of "defensive" is a matter of your insistence asking basing your questions in your opinion without think that some others developers may have different opinion.

In SVN there are different ways to manage trunk-branches-tags, that's all.

2009/11/7 alberto rodriguez <albert...@gmail.com>



--
Fabio Maulo

Zdeslav Vojkovic

unread,
Nov 7, 2009, 10:54:19 AM11/7/09
to nhu...@googlegroups.com
What's wrong with asking questions based on one's opinion?

It seems to logical to me that Alberto was asking based on his
opinions (who else's?) and in a rather polite way. The question
itself seemed like he was trying to understand NH developers' opinion
why feature development is done this way (regardless of what is
'wrong' and 'right').

Instead, you decide to reply with counter-question which was really
trying to engage into opinions fight. To me, it looks like you were
not really trying to answer but to start a flamewar. After all, you
did answer in you fourth reply: you could have done that in your first
reply and save your energy and everyone from this useless 'holier than
thou' tirade:

"If you have another standard in your mind you can apply it in your team."
"Is it clear now? or you need some other explications?"

Of course, I don't want to intrude into your right to answer and
discuss in any way you want, but it's funny that you find yourself so
insulted by a rather normal question.

Fabio Maulo

unread,
Nov 7, 2009, 11:07:11 AM11/7/09
to nhu...@googlegroups.com
insulted??!?!??
you don't know me.


2009/11/7 Zdeslav Vojkovic <zdeslav....@gmail.com>



--
Fabio Maulo

Mohamed Meligy

unread,
Nov 7, 2009, 3:30:04 PM11/7/09
to nhu...@googlegroups.com
Sorry Fabio but I seem to give +1 to Zdeslav.

You were quite defensive and sort of attacking answering the guy's question.
When he asked it, it made me think also "yeah, ti can be done either ways. I wonder how those guys think about it and whether they'll consider a shift in their thinking, or else, why they have it". You answered all this clearly, but it could have been said in much quieter way I'd say.

I hope no body will have to say something similar about your reply to this email :).

Oh, and -honestly not politically- thanks a lot for your contributions (and every other contributor) in NHibernate, a true artifact.

Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies) – Applications Delivery - TDG

Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

Fabio Maulo

unread,
Nov 7, 2009, 3:41:05 PM11/7/09
to nhu...@googlegroups.com
bah?!?!?

2009/11/7 Mohamed Meligy <eng.m...@gmail.com>



--
Fabio Maulo

Mohamed Meligy

unread,
Nov 7, 2009, 4:02:10 PM11/7/09
to nhu...@googlegroups.com
Nothing :).

Anyway, buy to main topic of the thread gentlemen...

I see the answer to "my" question (the original question of the thread) is that the version in trunk is the "version of the future" but it's not ready now, neither is the contrb version, so, you should ready for all kinds of surprises using any.


Sounds cool for me, but does it mean the contrib version shall stop sometime soon and "all" LINQ effort will go to the trunk version?

Thanks a lot.


Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies) – Applications Delivery - TDG
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: eng.m...@gmail.com
Weblog: http://weblogs.asp.net/meligy


Mohamed Meligy

unread,
Nov 7, 2009, 4:02:58 PM11/7/09
to nhu...@googlegroups.com
* sorry, I eman "back" in the second line of my last email.


Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies) – Applications Delivery - TDG
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: eng.m...@gmail.com
Weblog: http://weblogs.asp.net/meligy


Billy Stack

unread,
Nov 7, 2009, 4:47:13 PM11/7/09
to nhu...@googlegroups.com
I couldnt let this email thread pass without giving my opinion...where
I think this is ridiculous behaviour.

Do ye all realise that the NHibernate ORM is "open source". People
like the likes of Fabio spend a huge amount of their own "free" time
working on NH and supporting NH users (i.e. this forum)

I have been following the nhusers forum for a long while. The support
provided by Fabio + others has been fantastic.

Lets have a small bit of respect please!!!

Zdeslav Vojkovic

unread,
Nov 7, 2009, 7:29:48 PM11/7/09
to nhu...@googlegroups.com
I guess 'ye all' includes me, too.

Yes, I know NH is open source and I honestly do have a huge respect
for what Fabio does for NH.
Also, I have no problem with opinionated people, I prefer that to
people with no opinion whatsoever.
Still, how does it entitle anyone to be rude? How does that make
anyone incontestable?

Then again, maybe it is just language barrier, and something got lost
in translation.

Fabio Maulo

unread,
Nov 8, 2009, 6:27:02 AM11/8/09
to nhu...@googlegroups.com
Many thanks Billy but don't worry, I prefer to stay without a lawyer.

This is not the first time that somebody define as "rude", "aggressive" or whatever what I'm writing in this forum.

Perhaps I must accept that I'm a tough guy (for some reason my logo is "Oc" the hungry dog).

2009/11/7 Billy Stack <bs.s...@gmail.com>



--
Fabio Maulo

Mohamed Meligy

unread,
Nov 8, 2009, 12:11:49 PM11/8/09
to nhu...@googlegroups.com
Anyway, regarding the main topic of the thread...

I see the answer to the original question of the thread is that the version in trunk is the "version of the future" but it's not ready now, neither is the contrb version, so, you should ready for all kinds of surprises using any.



Sounds cool for me, but does it mean the contrib version shall stop sometime soon and "all" LINQ effort will go to the trunk version?

Thanks a lot.


P.S. I play to investigate NHibernate source code itself next month when I have annual vacation. Maybe I can help with something related to LINQ. It's also interesting to ehar about if some rough time line exists for NHibernate 3.0. I know things don't go that accurate time lines in OSS, but if a rough one exists...

Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies) – Applications Delivery - TDG

Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

Mohamed Meligy

unread,
Nov 8, 2009, 12:29:51 PM11/8/09
to nhu...@googlegroups.com
Just explanation:
Since coming from LLBLGen Pro background (I tired others like .NETTiers, Linq To Sql, Entity Framework, but this is the only one I liked, and though NHibernate would be the only as-strong free alternative).

I prefer to deal with completely typed Queries, writing SQL/HQL or using queries/criteria that requires any use of strings turns me off unless in advanced scenarios like formula (an opinionated subject, I admit).

So, I thought LINQ to NHibernate would be the best solution for this (NHibernate with 100% strongly typed query API). Is this the right choice (regardless of whether it's right to ask for this please) or there is another suggested typed query API?


Thank you very much,


Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies) – Applications Delivery - TDG
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: eng.m...@gmail.com
Weblog: http://weblogs.asp.net/meligy


Wayne Douglas

unread,
Nov 8, 2009, 1:11:34 PM11/8/09
to nhu...@googlegroups.com
Same route I took! Both llblgen and nhibernate are great. 

I'm using contrib linq for basic queries but fall back to hql for mid complex stuff and SPs for the nasty stuff. All thru nhib

Hth

-----------------------------
e-wayne <at> isit.gd
t-07525 424 882
Reply all
Reply to author
Forward
0 new messages