I want to concat Employee firstname and lastname at select clause but it gives :
Could not determine member from new <>f__AnonymousType0`1(name = Format("{0} {1}", x.FirstName, x.LastName))
var returnData = UnitOfWork.CurrentSession.QueryOver<Employee>()
.OrderBy(x => x.Id).Asc
.SelectList(u => u.Select(x => x.Id).WithAlias(() =>
businessSectorItem.id)
.Select(x => new { name = string.Format("{0} {1}",
x.FirstName, x.LastName) })
.WithAlias(() => businessSectorItem.text))
.Where(x => (x.FirstName.IsInsensitiveLike
("%" + searchTerm + "%") ||
x.LastName.IsInsensitiveLike
("%" + searchTerm + "%")) &&
( x.Account == null || x.Account.Id ==
accountId))
.TransformUsing(Transformers
.AliasToBean<SearchEmployeeItemDto>())
.Take(limit)
.List<SearchEmployeeItemDto>();
string.Formathas a lot of different options that is too complex for most SQL engines to accomplish, try usingx.FirstName + " " + x.LastNamenew { name = string.Format("{0} {1}", x.FirstName, x.LastName) }. I am not familiar with fluent-nhibernate, but maybe you can use string directlystring.Format("{0} {1}", x.FirstName, x.LastName)? How will it interoperate with followingWithAliasI don't know, but, nonetheless, it is a fair guess to check.Select(x => x.FirstName+" "+x.LastName)it is also not workingx.FirstNameor justx.LastName? Will it work?