From: Radu B. (JIRA) <nh...@gm...> - 2011-05-29 00:04:37
|
[ http://216.121.112.228/browse/NH-2645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21216#action_21216 ] Radu Ban commented on NH-2645: ------------------------------ same as NH-2486 and NH-2380 > Distinct is not supported by SelectClauseVisitor > ------------------------------------------------ > > Key: NH-2645 > URL: http://216.121.112.228/browse/NH-2645 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.0.0.GA > Reporter: Paul Speranza > Priority: Minor > > I have the following LINQ query that is mapped to a view > QueryResult<List<PersonDemographic>> members = new QueryResult<List<PersonDemographic>>(); > var query = (from ms in this.Session.Query<MemberSummary>() > where ms.NameSearch.StartsWith(firstName.ToUpper()) > && ms.NameSearch2.StartsWith(lastName.ToUpper()) > select new PersonDemographic > { > FirstName = ms.FirstName.ToProperCase(), > LastName = ms.LastName.ToProperCase(), > PersonId = ms.Id, > Address = new Address > { > Line1 = ms.AddressLine1.ToProperCase(), > Line2 = ms.AddressLine2.ToProperCase(), > City = ms.City.ToProperCase(), > State = ms.State, > Zipcode = ms.Zipcode, > }, > PhoneNumber = new PhoneNumber > { > Number = string.IsNullOrWhiteSpace(ms.PhoneNumber) ? null : Regex.Replace(ms.PhoneNumber, @"(\d{3})(\d{3})(\d{4})", "$1-$2-$3") > } > }); > if (this.Session.Transaction.IsActive) > { > members.Data = query.Distinct().Take(15).ToList(); > } > else > { > using (var transaction = this.Session.BeginTransaction()) > { > members.Data = query.Distinct().Take(15).ToList(); > transaction.Commit(); > } > } > > The code is running under the transaction section. If I use it without a Distinct I have no problem. Adding the Distinct gives me an exception > {"Expression type 10005 is not supported by this SelectClauseVisitor."} > I can't find anything definitive. Can anyone help? > Thanks, Paul -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |