Tuesday, December 7, 2010

Linq Expression Evaluation

If you have a Linq Expresssion (such as a reference to a variable in the closure) or really any other self-contained fragment, you can easily evaluate it by turning it into a lambda expression. For example, I was trying to evaluate the content of a variable that was showing up as a ".x" field. To do so, I did the following:



 

Saturday, December 4, 2010

NHibernate 3.0

NHibernate 3.0.GA has been released!  It has all sorts of goodies like QueryOver, logging abstraction, and tons more.  It also now has a built-in LINQ provider.  Unfortunately, the LINQ provider is still in a beta state.  Many queries work (as evidenced by the hundreds of working unit tests), but there are also still many queries it has trouble with.  If you'd like to help accelerate the development of the LINQ provider (or any other part of NH for that matter), here's what you can do:
  1. File issues when you find bugs.  http://jira.nhforge.org/
  2. Vote for issues.  Popularity is difficult to gauge if we don't hear back from people.
  3. Provide test cases for those issues.  A complete test case is easier to digest than a tiny code fragment without context.  If the test can be used directly, the team member working on the issue can spend more of their time making improvements instead of trying to recreate a test.
  4. If you're feeling ambitious, dig into the source code and try to work out a fix.
There's a great article on making tests for NHibernate here.  I've also included some different steps that might help you out.
  1. Check out the trunk using something like TortoiseSVN (https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate)
  2. Use ShowBuildMenu.bat to create the AssemblyInfo.cs files.
  3. Load up NHibernate.Everything.sln in Visual Studio.
  4. Create a test with the issue number in the NHSpecificTest folder of the NHibernate.Test project (NH2392 is a fairly simple example to copy from).
  5. Use ShowBuildMenu.bat to see how to set up your database connection and run all the tests.
  6. Create a patch (TortoiseSVN can help you with this) and attach it to the JIRA issue.
With your help, we will work towards a rock solid LINQ release that matches the tremendous power and reliability already provided by the NHibernate platform.