KnowledgeSyncProvider::BeginSession Method

When overridden in a derived class, notifies the provider that it is joining a synchronization session.

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

public:
virtual void BeginSession(
	SyncProviderPosition position, 
	SyncSessionContext^ syncSessionContext
) abstract

Parameters

position
Type: Microsoft.Synchronization::SyncProviderPosition
The position of this provider, relative to the other provider in the session.
syncSessionContext
Type: Microsoft.Synchronization::SyncSessionContext
The current status of the corresponding session.

This method throws InvalidOperationException when the provider cannot begin a session, such as when the provider is not initialized, has an invalid configuration, or is already enlisted in an uncompleted session.

The following example stores the session context. This object is released in the EndSession method.

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

    _sessionContext = syncSessionContext;
}


Show: