Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nhibernate async/await pattern #2803

Unanswered
stcom77 asked this question in Q&A
Discussion options

Hi. I saw the examples how to use nHibernate 5 async features, something like this.

async Task<Item> GetItems(){
 return await _session.ListAsync();
}

Why should to use async/await instead of just?

Task<Item> GetItems(){
 return _session.ListAsync();
}

It lets us avoid the async/await overhead. Or maybe are any other reasons to do like in the first example.
I have read the documentation but didn't find an answer. Maybe are any limitations and the second example will not work?

You must be logged in to vote

Replies: 2 comments

Comment options

It does not matter as long as you do not forget to await the final call like this:

var items = await GetItems();
You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /