KnowledgeSyncProvider::EndSession Method

When overridden in a derived class, notifies the provider that a synchronization session to which it was enlisted has completed.

Namespace:  Microsoft.Synchronization
Assembly:  Microsoft.Synchronization (in Microsoft.Synchronization.dll)

public:
virtual void EndSession(
	SyncSessionContext^ syncSessionContext
) abstract

Parameters

syncSessionContext
Type: Microsoft.Synchronization::SyncSessionContext
The current status of the corresponding session.

syncSessionContext will be equal to the SyncSessionContext object provided to the previous corresponding call to BeginSession.

This method throws InvalidOperationException when the provider did not previously receive a call to BeginSession for the session that is specified by syncSessionContext.

The following example releases the session context that was previously passed to the BeginSession method.

public override void EndSession(SyncSessionContext syncSessionContext)
{
    // If this object is not in a session, throw an exception.
    if (null == _sessionContext)
    {
        throw new SyncInvalidOperationException();            
    }

    _sessionContext = null;
}


Show: