[Visual Basic 6.0]Public Sub UnRegisterReplica(repName As String, ws1 As IWorkspace, Optional ws2 As IWorkspace = Nothing)
Dim wsReps As IWorkspaceReplicas
Set wsReps = ws1
Dim rep As IReplica
Set rep = wsReps.ReplicaByName(repName)
Dim wsRepsAdmin As IWorkspaceReplicasAdmin
If Not rep Is Nothing Then
Set wsRepsAdmin = wsReps
wsRepsAdmin.UnRegisterReplica rep, True
End If
'ws2
If Not ws2 Is Nothing Then
Set wsReps = ws2
Set rep = wsReps.ReplicaByName(repName)
If Not rep Is Nothing Then
Set wsRepsAdmin = wsReps
wsRepsAdmin.UnRegisterReplica rep, True
End If
End If
End Sub
[C#]public void UnRegisterReplica(IGeoDataServer gds, string repName)
{
IGPReplicas gpReps = gds.Replicas;
if (gpReps == null)
{
Console.WriteLine("There are no replicas in the workspace");
}IGPReplica rep;for (int i = 0; (i < (gpReps.Count - 1)); i++)
{
rep = gpReps.get_Element(i);
//++ Compare repName to unqualified name of the replica to verify replica exists
//++ Then unregister the replica
if (repName.ToUpper() == (rep.Name.Substring(rep.Name.LastIndexOf(".") + 1)).ToUpper)
{repName = rep.Name
rep = null;
gds.UnregisterReplica(repName);
return;
}
}
}
[Visual Basic .NET, C++]
No example is available for Visual Basic .NET or C++. To view a Visual Basic 6.0 or C# example, click the Language Filter button
in the upper-left corner of the page.