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)
Syntax
'Declaration
Public MustOverride Sub BeginSession ( _
position As SyncProviderPosition, _
syncSessionContext As SyncSessionContext _
)
'Usage
Dim instance As KnowledgeSyncProvider
Dim position As SyncProviderPosition
Dim syncSessionContext As SyncSessionContext
instance.BeginSession(position, syncSessionContext)
public abstract void BeginSession(
SyncProviderPosition position,
SyncSessionContext syncSessionContext
)
public:
virtual void BeginSession(
SyncProviderPosition position,
SyncSessionContext^ syncSessionContext
) abstract
abstract BeginSession :
position:SyncProviderPosition *
syncSessionContext:SyncSessionContext -> unit
public abstract function BeginSession(
position : SyncProviderPosition,
syncSessionContext : SyncSessionContext
)
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.
Remarks
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.
Examples
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;
}