I’m looking for a way to do a simple
SELECT foo FROM bar WHERE foo = x
in NHibernate. I’m also not sure as whether this would be best achieved using Linq2NHibernate, or just NHibernate. Searching and reading Google’s results for whatever reason hasn’t given me much luck.
I’m also using MySQL as the database engine, in case there are sudden differences from SQL to MySQL in terms of syntax.
Thanks for the help.
Assumptions:
var fooList = session.CreateQuery("SELECT foo FROM bar WHERE foo =:x")
.SetParameter("x","value of x").List<Foo>();Notice that: