7

NH 3.0クックブックからいくつかのコードを試していますが、なぜ以下のコードをコンパイルできないのか疑問に思っています。これを機能させる必要があるQueryProjectionBuilderは「NHibernate.Criterion.Lambda」にあると思いますが、そのためのusingディレクティブは役に立ちません。

問題は、SelectGroupとSelectAvgの部分です。本の構文が正しいと仮定すると、誰かがここで欠落している参照を見ることができますか?

namespace Queries.Implementations
{
using System;
using System.Collections.Generic;
using System.Linq;
using Eg.Core;
using NHibernate;
using NHibernate.Criterion;
using NHibernate.Criterion.Lambda;

    public class QueryOverQueries : CookbookQueriesBase
    {

        public override IEnumerable<NameAndPrice> GetAvgDirectorPrice(ISession session) {
            return _session.QueryOver<Movie>()
                .Select(list => list
                                    .SelectGroup(m => m.Director)
                                    .SelectAvg(m => m.UnitPrice)
                )
                .List<object[]>()
                .Select(props =>
                        new NameAndPrice
                        {
                            Name = (string) props[0],
                            Price = (decimal) props[1]
                        });

        }
    }
}
4

1 に答える 1

10

.SelectList代わりに使用する必要があります.Select

于 2010-12-19T11:32:44.363 に答える