次の方法で共有


CReplicationInstance.Query Method

Updates the information about a replication that was initiated for a Commerce Server Staging (CSS) project.

void Query()

Remarks

You must have CSS administrator or operator rights to call this method.

You must call the Query method before you can obtain accurate information about the properties of a CReplicationInstance object.

The CReplicationInstance.Query method corresponds to the COM method named ReplicationInstance.Query.

Example

The following example displays information about the replications that completed successfully (replication state=9) for the project named Project1. For another example of how to use the Query method, see the CReplicationProject.Start method.

CReplicationServer replicationServer = new CReplicationServer();
replicationServer.Initialize("");
CReplicationProject replicationProject = (CReplicationProject)replicationServer.OpenProject("Project1", CSS_PROJECT_CREATION.OPEN_EXISTING_PROJECT);
Console.WriteLine("The following replications were canceled:");
int iterator = 0;
object i = iterator as object;
CReplicationInstance replicationInstance;
while (true)
{
    try
    {
        replicationInstance = (CReplicationInstance)replicationProject.EnumReplications(9, ref i);
        // Update Instance properties
        replicationInstance.Query();
        // Display Instance properties
        Console.WriteLine("Replication {0} had the following information:", replicationInstance.Name);
        Console.WriteLine("");
        Console.WriteLine("Bytes received: {0}", replicationInstance.BytesReceived);
        Console.WriteLine("Bytes sent: {0}", replicationInstance.BytesSent);
        Console.WriteLine("Files with errors: {0}", replicationInstance.FilesErrored);
        Console.WriteLine("Files errored bytes: {0}", replicationInstance.FilesErroredBytes);
        Console.WriteLine("Files matched: {0}", replicationInstance.FilesMatched);
        Console.WriteLine("Files matched bytes: {0}", replicationInstance.FilesMatchedBytes);
        Console.WriteLine("Files sent: {0}", replicationInstance.FilesSent);
        Console.WriteLine("Flags: {0}", replicationInstance.Flags);
        Console.WriteLine("ID: {0}", replicationInstance.ID);
        Console.WriteLine("Start time: {0}", replicationInstance.StartTime);
        Console.WriteLine("End time: {0}", replicationInstance.EndTime);
        Console.WriteLine("Status: {0}", replicationInstance.Status);
    }
    catch (System.Runtime.InteropServices.COMException e)
    {
        // Quit if "No more items" error
        if (e.ErrorCode == -2147422485)
                break;
            else
                throw e;
    }
}

See Also

Other Resources

CReplicationProject.EnumReplications Method

CReplicationInstance.ID Property

CReplicationInstance Class