One way to increase scalability of the server application is to run IO-bound operation (reading files, sockets, web requests, database requests etc) asynchronously. This doe
As of NHibernate v5, async is now fully supported!
Here are some nifty examples:
Customer customer = await session.GetAsync(1);
List customers = await session.Query().ToListAsync();
Customer customer = await session.Query()
.Where(x => x.Name.Contains("Customer 1"))
.SingleOrDefaultAsync();
Updating an entity
using (ISession session = sessionFactory.OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
Customer customer = await session.GetAsync(1);
customer.Name = "Customer 3";
await session.SaveOrUpdateAsync(customer);
await transaction.CommitAsync();
}
Source article