A have an action in my MVC application that has idand returns the name of the person.
What is the best practice for this? I follow the advice of NHProf, but the code sounds a little strange or something for me.
using (var session = Helper.SessionFactory.OpenStatelessSession())
{
using (var tran = session.BeginTransaction(IsolationLevel.ReadCommitted))
{
return session.Query<Person>().Where(x => x.Id == id).Select(x => x.Name).SingleOrDefault();
tran.Rollback();
}
}
source
share