This is a mirror of official site: http://jasper-net.blogspot.com/

NHibernate Work-Around is not really a Work-Around…

| Wednesday, August 17, 2011
Over the weekend I came across a blog post about NHibernate, and an apparent work-around for a feature not supported by NHibernate.

The original post can be found here: nHibernate LINQ workaround for System.NotSupportedException

Basically the author wanted to write something along the lines of:
var fruitIds = new List<int> { 5, 8, 13 };

using (var session = factory.OpenSession())
{
    var result = from f in session.Query<NHFruit>()
                 join i in fruitIds
                     on f.Id equals i
                 select f;

    foreach (var fruit in result)
        Console.WriteLine(fruit.Name);
}

Where the query joins to a list of Ids to filter the results out. This however, happens to throw an exception:

image_thumb7.png

Read more: Phillip Haydon
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://www.philliphaydon.com/2011/08/nhibernate-work-around-is-not-really-a-work-around/

Posted via email from Jasper-net

0 comments: