2

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

1 Answer 1

7

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>();           
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.