次の方法で共有


CReplicationRoute.Enum Method

Retrieves the properties that are defined for a Commerce Server Staging (CSS) route.

object Enum(ref object iterator, ref object routeParam)

Parameters

  • iterator
    Used by the service to enumerate the list of properties. This value should be initialized to 0 (zero) and should not be modified.

  • routeParam
    Used by the service to return the name of the property. This value should be initialized to an empty string ("") and should not be modified.

Return Value

The value of the property that is returned for this iteration, or the value -2147422485 (“No more items.”), which indicates the end of the enumeration. The name of the property is indicated by the value of the RouteParam parameter after the call returns.

Remarks

The only properties that are available are BaseDirectory and Destinations. You can set the BaseDirectory property by using either the BaseDirectory property or the Put method. You can set the Destination property by using the AddDestination method.

The CReplicationRoute.Enum method corresponds to the COM method named ReplicationRoute.Enum.

Example

The following example lists the names and values of all the properties for the Temp route.

CReplicationServer replicationServer = new CReplicationServer();
replicationServer.Initialize("");
CReplicationRoute replicationRoute;
int i = 0;
object iterator1 = i as object;
// Get a route
while (true)
  {
  try
    {
    replicationRoute = replicationServer.EnumRoutes(ref iterator1) as CReplicationRoute;
    if (replicationRoute.get_Name().ToString() == "Temp")
      {
      int j = 0;
      object iterator2 = j as object;
      while (true)
        {
        try
          {
          object routeParam = new object();
          object value = replicationRoute.Enum(ref iterator2, ref routeParam);
          if (routeParam.ToString() == "Destination")
            {
            Console.Write("Destinations = ");
            foreach (object destination in (object[])value)
              {
               Console.Write("{0} ", destination);
              }
            }
            else // That is. routeParam = BaseDirectory
             {
             Console.Write("BaseDirectory = {0}", value);
             }
          }
          catch (System.Runtime.InteropServices.COMException e)
          {
            if (e.ErrorCode == -2147422485)
              break;
            else
              throw e;
            }
          }
        break;
      }
    }
    catch (System.Runtime.InteropServices.COMException e)
    {
         // Exit if "No more items" or "No routes" error
         if (e.ErrorCode == -2147422485 || e.ErrorCode == -1073680678)
            break;
        else
            throw;
    }
  }

See Also

Other Resources

CReplicationRoute.BaseDirectory Property

CReplicationRoute.Get Method

CReplicationRoute.Put Method

CReplicationRoute Class