title: nHibernate Linq Projection
body: <p>I am using the version 1.0 release of Linq for nHibernate. When I run
  the following linq statements I receive the error</p>
  
  <p><strong>not a single-length projection: Surname</strong></p>
  
  <p>I can find very few references to this on the web and looking into the
  source it says it should never occur! ClientID is a Int type and
  Surname is a string. When I comment out all the string fields in the
  projection and just leave ClientID it runs ok, but as soon as I add
  surname back it errors.</p>
  
  <pre><code>var context = m_ClientRepository.Linq;
  
  var result = (from client in context
                from address in client.Addresses
                from contact in client.Contacts
                where client.Surname.StartsWith(surname)
                &amp;&amp; client.GivenName.StartsWith(givenName)
                &amp;&amp; contact.Value.StartsWith(phoneNumber)
                group client by new { client.ClientID, client.Surname, client.GivenName } into clientGroup
                select new ClientSearchDTO()
                {
                    ClientID = clientGroup.Key.ClientID,
                    Surname = clientGroup.Key.Surname,
                    GivenName = clientGroup.Key.GivenName,
                    Address = clientGroup.Max(x =&gt; x.Addresses.FirstOrDefault().Address),
                    PhoneNumber = clientGroup.Max(x =&gt; x.Contacts.FirstOrDefault().Value)
                })
                .Skip(Paging.FirstRecord(pageNumber))
                .Take(5);
  </code></pre>