Прочитај на енглеском

Делите путем


ValidationMethod Enum

Definition

Enumerates methods supported for rowcount validation of transactional publications.

C#
public enum ValidationMethod
Inheritance
ValidationMethod

Fields

Name Value Description
FullCount 0

Performs a full rowcount using the COUNT function.

FastCount 1

Performs a fast rowcount validation using the sys.sysindexes system table.

ConditionalFast 2

Attempts a fast rowcount, but performs a full rowcount if the fast method shows any differences.

Examples

C#
// Define the server, database, and publication names
string publisherName = publisherInstance;
string publicationName = "AdvWorksProductTran";
string publicationDbName = "AdventureWorks2012";

TransPublication publication;

// Create a connection to the Publisher.
ServerConnection conn = new ServerConnection(publisherName);

try
{
    // Connect to the Publisher.
    conn.Connect();

    // Set the required properties for the publication.
    publication = new TransPublication();
    publication.ConnectionContext = conn;
    publication.Name = publicationName;
    publication.DatabaseName = publicationDbName;

    // If we can't get the properties for this publication, 
    // throw an application exception.
    if (publication.LoadProperties())
    {
        // Initiate validataion for all subscriptions to this publication.
        publication.ValidatePublication(ValidationOption.RowCountOnly,
            ValidationMethod.ConditionalFast, false);

        // If not already running, start the Distribution Agent at each 
        // Subscriber to synchronize and validate the subscriptions.
    }
    else
    {
        throw new ApplicationException(String.Format(
            "Settings could not be retrieved for the publication. " +
            "Ensure that the publication {0} exists on {1}.",
            publicationName, publisherName));
    }
}
catch (Exception ex)
{
    // Do error handling here.
    throw new ApplicationException(
        "Subscription validation could not be initiated.", ex);
}
finally
{
    conn.Disconnect();
}

Remarks

This namespace, class, or member is supported only in version 2.0 of the .NET Framework.

Applies to

Производ Верзије
SQL Server .NET SDK 2016

See also