Skip to Content

Class SessionOpener

A session that has not been opened yet.

Awaiting it opens one and yields the Session; awaiting it again yields the same session rather than opening a second one. Nothing is sent until it is awaited, so an opener that is created and dropped costs no call and produces no unhandled rejection.

It deliberately carries no Symbol.asyncDispose of its own. await using binds the expression rather than anything awaited out of it, so await using s = client.memory.withSession(d) would bind this object and not the session it opens — leaving that off makes it a type error rather than a puzzle at run time. Write await using s = await client.memory.withSession(d).

Implements

Index