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
public abstract void BeginSession (
SyncProviderPosition position,
SyncSessionContext syncSessionContext
)
public abstract function BeginSession (
position : SyncProviderPosition,
syncSessionContext : SyncSessionContext
)
Parameters
- position
The position of this provider, relative to the other provider in the session.
- 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.
Example
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;
}
See Also
Reference
KnowledgeSyncProvider Class
KnowledgeSyncProvider Members
Microsoft.Synchronization Namespace