开发者

fluent nhibernate not supported exception newexpression

开发者 https://www.devze.com 2023-02-03 07:00 出处:网络
can anyone help me figure out what I\'m doing wrong. I\'m new to nhibernate andI\'m finding it quite hard to really get comfortable with it. I have t开发者_高级运维his query:

can anyone help me figure out what I'm doing wrong. I'm new to nhibernate and I'm finding it quite hard to really get comfortable with it. I have t开发者_高级运维his query:

        var results2 = (from purchase in _session.Query<Purchase>()
                        group purchase by new { purchase.symbol } into purchases
                        select new Quote()
                        {
                            shares= purchases.Sum(p => p.shares)
                        }).ToList();

but I get notsupportedexception and the error message is just newexpression.


Looking at the question's date, I guess that question was about NHibernate pre-3.2.

Assuming that your Quote is a simple POCO class and you use NHibernate 3.2 or later, this query works fine - see my blog post for some details about GroupBy capabilities in NHibernate.

So the solution simply is to upgrade.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号