Reputation: 154
I have this code to return all colors with have some text:
public IEnumerable<Color> FindStartingWith(string term)
{
return Session.QueryOver<Color>().Where(color => color.Name.IsLike(text, MatchMode.Anywhere)).List();
}
But what I want to do, is return a STRING IEnumerable containing only a list of color.Name...
How can I do that with QueryOver?
Thanks
Junio
Upvotes: 2
Views: 1945
Reputation: 15303
Syntax may not be exactly right but should be somethign like:
public IEnumerable<string> FindStartingWith(string term)
{
return Session.QueryOver<Color>()
.Select(color => color.Name)
.Where(color => color.Name.IsLike(text, MatchMode.Anywhere))
.List<string>();
}
Upvotes: 7