[Mono-dev] Linq, Nhibernate or subsonic ?

Onur Gumus emperon at gmail.com
Sat Jun 28 19:51:03 EDT 2008


yes I did try linq to sql. As a matter of fact at the very beggining
of this conversation, I did told those reflect my opinions only and I
did not want to start a flamewar. Yet I see you are offended. I
certainly understand your pain since it appears to be you love linq to
sql and may be waiting for it's implementation on mono and some guy
just came up and saying hey no need for linq to sql , we' got
nhibernate.

Frankly side by side technical comparison I still consider nhibernate
superior. For the following reasons:

NHibenate works with almost every database and you can  develop true
database independent applications. For instance when you finish your
product's coding you can deliver it for different databases. Same
cannot be applied to linq to sql which only works for sql server. Sure
there are implementations for postgress as well but you stick to one
database and cannot further modify it.

traditionally nhibernate uses criteria and hql based queries which
look weird compared to linq's static typing power. But then now we
have linq to nhibernate functional and running.

Furthermore you are incorrect about xml  because nhibernate supports
Attribute based mapping and another option is Castle ActiveRecord.
Where you can do the mapping with 0 XML. That's what I do.

linq to sql is more data centric approach. You first create your
database and from there you generate your classes via sql metal. And
the generated code is messy. NHibernate uses domain driven approach
which is better for larger scale applications. Namely you totally
ignore the existence of your database and just write you classes
(including interfaces and your inheritence tree). Then you make your
mapping finally you tell nhibernate create the tables for you. It is
much more powerful than what linq to sql is capable of. Also linq to
sql can only have 1 type of mapping for inheritence where as
nhibernate supports 3 types . see how inheritence is applied to both.
And I don't think linq to sql supports persistance for your
"interfaces"

For databinding to gui I use my modified object data source which is
just good. But there are other solutions like
http://www.codeproject.com/KB/aspnet/NHibernateDataSource.aspx  for
web applications .

that's just my 2 cents






On Sat, Jun 28, 2008 at 10:59 PM, Sharique uddin Ahmed Farooqui
<safknw at gmail.com> wrote:
> Thanks nicole.
> I'm using sunsonic. It is quite easy to learn and it works with .net
> 2.0 and mono as well.
> I'll suggest Subsonic other as well.
>
> On Mon, Jun 23, 2008 at 8:01 PM, nicolasdiazaragon
> <nico.diaz.aragon at gmail.com> wrote:
>>
>> What do you mean by saying that not yet having linq to sql isn´t a big loss
>> and that it can be replaced by using nhibernate?
>> Have you tried linq to sql? have you compared it to using hibernate?
>> Maybe if all you code is meant to be part of some desktop application, then
>> you are fine with hibernate. But if you intend to build real enterprise
>> applications, then you should use linq to sql. Not only does it make code
>> more simple and easy to read, it gets things done faster than hibernate does
>> and you don't have to bother writing boring XML files. And it let´s you use
>> nameless class types while querying the data base. These nameless classes
>> can then be bound to a GUI control or used for further processing. Try doing
>> that with hibernate... you would have to perform very expensive castings
>> (all your query results are strongly typed in linq to sql, but not in
>> hibernate... everything returned by a hibernate query is just an
>> 'object'...) and there is absolutely no WAY to use nameless types while
>> querying the database with hibernate.
>> I've been writing java code since I was a 14 year old. I begun coding JEE at
>> the same time I became acquainted with the dot net framework. By the time
>> linq to sql was released (a couple of years later) I was very dissapointed
>> because I realized that the dot net framework had leaped light years ahead
>> of java (my personal favorite until then).
>> So no linq to sql support is a huge loss to me. If I were to code some
>> enterprise application without linq to sql support, I´d rather work on JEE
>> than on dot net.
>>
>>
>> reverse blade wrote:
>>>
>>> Before comparing the technical merits you should consider that "Linq to
>>> SQL"
>>> is not supported by mono at the moment.(Which is not a big loss for me
>>> anyway). Linq is the general name given to linq bindings and currently we
>>> have : Linq to Objects, Linq to Sql, Linq to XML, Linq to JSON, Linq to
>>> NHibernate, Linq to DB4O, etc ... bindings  are available if I recall
>>> correctly.
>>>
>>> For subsonic and NHibernate , I never used subsonic on mono but I've read
>>> it
>>> was working on mono. On the other hand, I used NHibernate extensively on
>>> mono/linux/postgresql and I am quite happy with it.
>>>
>>> Finally, Nhibernate does support stored procs but triggers and views are
>>> not
>>> supported by any of these frameworks directly. NHibernate offers
>>> interceptors for intercepting your db transactions before it hits to db's
>>> so
>>> in a way it emulates triggers that way. Still however you can use triggers
>>> independently. Not sure how others handle it. Finally it took 1 full month
>>> for me to feel myself comfortable with NHibernate due to it's high
>>> complexity (or may be I am not smart enough), but it was well worth.
>>>
>>>
>>>
>>> just my 2 cents
>>>
>>> Onur
>>>
>>> 2008/2/24 Sharique uddin Ahmed Farooqui <safknw at gmail.com>:
>>>
>>>> Hi,
>>>>
>>>> I'm planning to build an ERP for my organisation. We will use mono as
>>>> primary development platform. I'm a bit confused abt what should for DAL.
>>>> I
>>>> know little abt linq .
>>>> What I have decided for DAL is
>>>> 1. auto generated code must be extend able either in same class or as a
>>>> separate class.
>>>> 2. It must expose all databse views, triggers, stored procedures in DAL.
>>>>
>>>>
>>>> Pls help me find out the right thing.
>>>>
>>>> Thanks.
>>>> --
>>>> Sharique uddin Ahmed Farooqui
>>>> (C++/C# Developer, IT Consultant)
>>>> A revolution is about to begin.
>>>> A world is about to change.
>>>> And you and I are "the initiator".
>>>> _______________________________________________
>>>> Mono-devel-list mailing list
>>>> Mono-devel-list at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Linq%2C-Nhibernate-or-subsonic---tp16138540p18070501.html
>> Sent from the Mono - Dev mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>
>
>
> --
> Sharique uddin Ahmed Farooqui
> (C++/C# Developer, IT Consultant)
> http://safknw.blogspot.com/
> "Peace" is the Ultimate thing we want.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>


More information about the Mono-devel-list mailing list