Pip-Services-Commons-Dotnet
Public Member Functions | List of all members
PipServices3.Commons.Run.IOpenable Interface Reference

Interface for components that require explicit opening and closing. More...

Inheritance diagram for PipServices3.Commons.Run.IOpenable:
PipServices3.Commons.Run.IClosable

Public Member Functions

bool IsOpen ()
 Checks if the component is opened. More...
 
Task OpenAsync (string correlationId)
 Opens the component. More...
 
- Public Member Functions inherited from PipServices3.Commons.Run.IClosable
Task CloseAsync (string correlationId)
 Closes component and frees used resources. More...
 

Detailed Description

Interface for components that require explicit opening and closing.

For components that perform opening on demand consider using IClosable interface instead.

class MyPersistence: IOpenable
{
private object _client;
...
public bool IsOpen()
{
return this._client != null;
}
public void Open(string correlationId)
{
if (this.isOpen())
{
return;
}
...
}
public void Close(string correlationId)
{
if (this._client != null)
{
this._client.Close();
this._client = null;
}
}
...
}

See Opener

Member Function Documentation

◆ IsOpen()

bool PipServices3.Commons.Run.IOpenable.IsOpen ( )

Checks if the component is opened.

Returns
true if the component has been opened and false otherwise.

◆ OpenAsync()

Task PipServices3.Commons.Run.IOpenable.OpenAsync ( string  correlationId)

Opens the component.

Parameters
correlationId(optional) transaction id to trace execution through call chain.

The documentation for this interface was generated from the following file: