I'm thinking about using Linq to NHibernate in an upcoming project, so I'd like some feedback about it. I found this identical question asked in February, and it seemed that Linq to NHibernate was not very mature at this time... Has it improved since then ? Has anyone used it in real life applications ?
Thanks for your feedback
PS: please do not close as duplicate : the existing question is almost 1 year old and I'm asking about the current status of the product...
Ayende (one of the more vocal contributors to NHibernate) noted in a blog post this week that NHibernate's LINQ support is somewhat lacking (as compared to Microsoft's Entity Framework). I don't believe much has changed in the last year in the production code base. He does note that the next version of NHibernate will improve on this support.
Linq to NHibernate is OK most of the time, but you need a fallback option.
I use it in a large project as the default query language as I expect it to become more mature soon, and I especially like its agnosicism towards the underlying framework - you can use it if you know the basics about O/R mappers and Linq; you don't need to be super-familiar with NHibernate in special. The other options for writing queries, especially the criteria query API, pose some extra learning effort. For most of the features, complex queries are not required, and Linq to NHibernate is good for some Wheres and OrderBys.
However, there are still odd cases of failure where the query itself is OK, but the generated SQL just is not. In these cases I don't spend time examining what's up, but fall back to the criteria query API.
Please refer to http://nhibernate.info/blog/2009/12/16/linq-to-nhibernate-progress-report-a-christmas-gift.html for the latest info
Hey I follow Steve Strong, as from what I understand, he is the main developer of this project.
here is his latest post "Using the new Linq to NH Provider and migrating from the old one " http://blogs.imeta.co.uk/sstrong/archive/2009/12/16/824.aspx note it was just after the NHForge latest post on this topic.
To get this version look at the HornGet link provied in the post
I looks really promising
bones
Related
I am not even sure how to ask this question. I am absolutely willing to research this myself, but I don't even know what exactly my options are.
I'm fairly new to programming in general, and I'm the sole developer on an ASP.NET MVC3 web application. We're about to upgrade to a new version which has a lot of addition to the data model. There are a couple new entities and some of the old entities have new properties/columns.
We've finished beta testing and now we're going to try to get everyone moved over to the new version running parallel to the current version, that way if there are show-stopping problems, users can easily switch back to the old version. The problem is that we can't hook both up to the same db because of the data model differences.
Can I make the old version use the new version's schema or something? I'm not really sure what my options are. I'm not asking you to write this for me; I'm just looking for some direction. Thanks!
You should be able to disable the metadata checks and then use two versions against the DB assuming the models use a schema that is compatible between both.
http://revweblog.wordpress.com/2011/05/16/ef-4-1-code-first-disable-checking-for-edmmetadata-table/
Another option is to use entity framework 4.3 code first migrations and actually use an upgrade script that it will generate for you. If it fails you can roll back the script to a prior version and use your prior code base. This would imply you upgrade to 4.3 first before doing anything else though although you could still disable metadata checks.
Well I am new to this ORM stuff. We have to create a large project. I read about LINQ to SQL. will it be appropriate to use it in the project of high risk. i found no problem with it personally but the thing is that there will be no going back once started.So i need some feedback from the ORM gurus here at the MSDN. Will entity framework will be better? (I am in doubt about LINK to SQL because I have read and heard negative feedback here and there)
I will be using MVC2 as the framework. So please give the feedback about LINQ to SQL in this regard.
Q2) Also I am a fan of stored procedure as they are precomputed and fasten up the thing and I have never worked without them.I know that LINQ to SQL support stored procedures but will it be feasible to give up stored procedure seeing the beautiful data access layer generated with little effort as we are also in a need of rapid development.
Q3) If some changes to some fields required in the database in LINK to SQL how will the changes be accommodated in the data access layer.
When it comes to Linq-to-Sql vs Entity Framework, I strongly suggest to use Entity Framework. With the release of .NET 4.0 and VS2010, Microsoft added soooo much goodness in Entity Framework(EF) 4.0. Let me just mention a few points: POCO and NTier support (this means that you can have a separate library with your simple entity classes and of course EF will still be aware of them), Lazy Loading, Sql query optimizations...Also you can let EF to generate your entities (and you have the option modify the T4 generation template) or you can create them by hand if you need more control. Also, if you app will indeed be large, with EF 4, now you can separate your layers quite nicely(you can create your Mocks fo testing etc...). I'm not a web developer, so I cannot give you any hints on mvc2 on this matter.
q2-q3) - in EF you can have precompiled queries - IF you observer later on that query performance is not quite what you need. This will speed-up things quite a bit. If you plan to use EF and if you add a few changed to you database, you can easily update your model with a click.
I know I babbled too much on EF and not Linq to sql :), but hey...I believe this suits way better on your needs and you should definitely check it out for this project. Also, I don't know how much Microsoft will add features / invest in LinqToSql in the future.
Cheers,
ok precompiled queries that certainly is catching my attention.
I often get in a position when I need to know why my LINQ doesnt work as intended...
I use object collections and extensions.
I dont want spend more than couple of minutes on it. LINQ supposed to make developer's life easier not harder.
I hoped VS 2010 will have it fixed but I now use RC and it still doesnt let me type LINQ and check what is going on... Says as before "Expression cannot contain lambda expressions"...
Is there some add-on for Visual Studio so I can quickly and effectively run ad-hoc queries and find out what is going on and where I am wrong?
It's not a VS plugin, but it's free and it's awesome: LinqPad
Check it out here
You can run whatever linq or code snippet in general, just give it a look, it's an incredibly useful tool, for linq and more.
Have you tried this?
Debugging LINQ Queries
Debugging LINQ queries can be
problematic. One of the reasons is
that quite often, you write a large
query as a single expression, and you
can’t set a breakpoint mid-expression.
Writing large queries in expression
context is particularly powerful when
using functional construction to form
XML (or using the strongly typed DOM
in Open XML SDK V2). This post
presents a little trick that makes it
easier to use the debugger with LINQ
queries that are written using ‘method
syntax’.
VS 2010 isn't going to address this..
There is, in fact, such a plugin as you describe, but unfortunately it is highly expiremental. You will probably need to install VS2008 SDK and the Service Packs to get it to work - I know I did..
Here is the link:
http://extendedimmediatewin.codeplex.com/
So the nHibernate 2.1 Alpha came out a few days ago, but the announcement on sourceforge doesn't mention the additional features. In particular, it doesn't mention whether LINQ is included. I know that I've read that LINQ would be part of 2.1, but that was 6 months ago. Anybody know if LINQ is in 2.1 or what new features are? There's no documenation about 2.1 alpha features on the official site.
LinqToNHibernate is being written by Steve Strong at IMeta. Steve is attempting an amazing task by changing the way NHibernate parses HQL from the string based system to an abstract syntax tree. To be fair he does have a head start as this is being done in Hibernate using ANTLR which he is porting to .Net. It still baffles my mind what he is undertaking. I must say well done to IMeta for giving Steve the time to work on this.
If you want to see how far he is going you can check the uNhAddIns repository.
There is also a workable LinqToNHibernate provider which you'll find in NHContrib I am using this on a few projects and it works well but isn't in active development now and does break down if you attempt complex Linq queries
We are using an oracle database in a project. Most of the tables represents classes or objects in the application. The application currently doesn't have a substantial amount of documentation. I am using StarUML to make up some class diagrams and such for other developers on the project to increase their understanding of the overall project. Using the database tables as a starting guide, and then making modifications to the diagrams as needed would be the absolute easiest and quickest way to get these set up. Is there any free applications that could assist me in pulling the schema out of the Oracle database and create class diagrams from them? Currently, there are 98 "objects" or classes closely modeled in the database and to create these all in a modeling application from scratch would be very time consuming.
You don't say what your target language is.
You can use Hibernate to generate schemas from an object model and mapping.
Middlegen is a tool that can create Java classes from schemas. Maybe those will help.
A 1:1 object-to-table mapping isn't always the best way to do things. It's hardly object-oriented. I'd view it as a starting point only.
I looked (briefly) through the StarUML documentation and don't see any way to import a database definition, so I'm not sure how you do this, sorry.
If you can find a way to get the data into StarURL, you could use Oracle's free SQL Developer tool to get the table definitions out as DDL or XML.
I know that Microsoft's Visio tool (Pro & Enterprise editions) can read selected tables from your Oracle database and generate models from that, but it ain't cheap. I really like Allround Automation's PL/SQL Developer as a reasonably-priced IDE targeted at programmers (vs DBAs) and I know that will generate diagrams locally. But I'm not sure it can save the metadata in a form you could use in StarUML.
Good luck,
-- Stew
It's a shame you didn't bother to respond to replies to your own question. Or am I misunderstanding the standard practice here that people just give points and move on?