T
thj
Hi,
I was wondering what you guys are using and why?
LINQ to SQL or NHibernate?
Thanks in advance,
Tommy
I was wondering what you guys are using and why?
LINQ to SQL or NHibernate?
Thanks in advance,
Tommy
thj said:Hi,
I was wondering what you guys are using and why?
LINQ to SQL or NHibernate?
thj said:I see. So whats the pros/cons of Entity Framework vs NHibernate?
Do you know of some describing articles on the subject?
LINQ to SQL or NHibernate?
Pavel said:Between those two, I'd definitely pick NHibernate. LINQ to SQL is not really
a proper ORM (and not advertised as such).
Now NHibernate vs Entity Framework is more interesting. The ORM part of
NHibernate is clearly more mature, but Entity Framework has LINQ support.
thj said:Hi,
I was wondering what you guys are using and why?
LINQ to SQL or NHibernate?
Alun said:NHibernate 2.1 now supports LINQ, although that does pretty much mean
checking out and building the trunk. For previous versions, you can use
Ayende's Linq for NHibernate.
Frans Bouma said:I wouldn't call that a linq provider. Linq providers have the disadvantage
that you have to cover EVERY situation, otherwise the developer can't use
linq at all, as you can't mix and match native query APIs with linq to
form a single query.
Therefore, a non-mature linq provider (and nhibernate's linq provider is
far from finished), is totally useless, even though it might mean it can
do a couple of from where select queries.
Pavel said:Is there even a LINQ IQueryable provider which can handle absolutely
anything I could throw at plain IEnumerable - arbitrary .NET method calls
etc - and give me the exact same semantics (sans unexpected errors such as
dropped connections, server down, etc)?
It was my impression so far that it's not possible to write advanced LINQ
queries in a generic fashion, because you always have to keep in mind the
limitations of the LINQ provider you're querying against (such as "what
methods of String are supported?" etc).
For one thing, if it provides static typing for otherwise typical
join-where-select, it's immediately quite useful.
Frans Bouma said:That's not the point. The point is that many 'linq providers' can't even
do decent joins, group joins, left joins etc. If you take one step further
than the default from where select, they often break.
Of course not. A decent linq provider would offer you a facility to map
methods which aren't mapped by default to db constructs yourself without a
lot of effort.
for an hour... sure. Then you are faced with more complex queries and you
first run into errors, then wonder if it's you, then lose another hour
trying to write workarounds and then you give up and fall back onto the
native api which is often using string-based queries...
Pavel said:Does NHibernate LINQ provider have the flaws you mentioned?
How does any such mapping facility helps? Let's say I write a method:
void Foo<T>(IQueryable<T> q);
As an author of the method, I don't know what is given to me, so I can't use
any provider-specific facilities for mapping. As a user of the method, I
treat it as a black box, and so I don't know what kind of method calls it
might make.
Frans Bouma said:If you do:
var q = from c in md.Customer
where MyMethods.SomeMethod(c.CompanyName)
select c;
the call to SomeMethod is in the expression tree. 'md' here is an
IQueryable which contains the provider. So before this query, I can pass a
mapping construct which maps SomeMethod(string) to a db construct and
returns a bool. (CASE construct)
Pavel said:I think you've missed my point. Foo<T> is a part of a reusable library.
Inside, it contains the LINQ query you gave, but it has no way to map
SomeMethod (or even know that it should be mapped). Outside, the client of
the library shouldn't have to second-guess what methods are used by
implementation of Foo<T>, and should be mapped as needed.
In short, it's very hard to deal with IQueryable<T> in a generic way even
with full-featured LINQ providers. Therefore, I question the assertion that
there is some significant leap between limited and full-featured providers -
if you can't use either one in a generic fashion in encapsulated code,
without minding the limitations of a specific provider (which kills the
genericity right on the spot), what's the real difference, aside from the
actual number of limitations?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.