This documentation is archived and is not being maintained.

ReplicationServer.RegisterBusinessLogicHandler Method

Registers a business logic handler assembly at the replication server.

Namespace: Microsoft.SqlServer.Replication
Assembly: Microsoft.SqlServer.Rmo (in microsoft.sqlserver.rmo.dll)

public void RegisterBusinessLogicHandler (
	BusinessLogicHandler businessLogicHandler
public void RegisterBusinessLogicHandler (
	BusinessLogicHandler businessLogicHandler
public function RegisterBusinessLogicHandler (
	businessLogicHandler : BusinessLogicHandler



A BusinessLogicHandler object that represents the business logic handler being registered.

The business logic handler must be registered at the Publisher and at the server on which the Merge Agent runs. However, the assembly that implements the business logic handler need only be installed on the server on which the Merge Agent runs.

The RegisterBusinessLogicHandler method can only be called by members of the sysadmin fixed server role and members of the db_owner fixed database role

Calling RegisterBusinessLogicHandler is equivalent to executing sp_registercustomresolver (Transact-SQL).

The RegisterBusinessLogicHandler method can only be used with servers running on SQL Server 2005 and later releases.

// Specify the Distributor name and business logic properties.
string distributorName = publisherInstance;
string assemblyName = @"C:\Program Files\Microsoft SQL Server\90\COM\CustomLogic.dll";
string className = "Microsoft.Samples.SqlServer.BusinessLogicHandler.OrderEntryBusinessLogicHandler";
string friendlyName = "OrderEntryLogic";

ReplicationServer distributor;
BusinessLogicHandler customLogic;

    // Create a connection to the Distributor.
ServerConnection distributorConn = new ServerConnection(distributorName);

    // Connect to the Distributor.

    // Set the Distributor properties.
    distributor = new ReplicationServer(distributorConn);

    // Set the business logic handler properties.
    customLogic = new BusinessLogicHandler();
    customLogic.DotNetAssemblyName = assemblyName;
    customLogic.DotNetClassName = className;
    customLogic.FriendlyName = friendlyName;
    customLogic.IsDotNetAssembly = true;

    Boolean isRegistered = false;

    // Check if the business logic handler is already registered at the Distributor.
    foreach (BusinessLogicHandler registeredLogic
        in distributor.EnumBusinessLogicHandlers())
        if (registeredLogic == customLogic)
            isRegistered = true;

    // Register the custom logic.
    if (!isRegistered)
catch (Exception ex)
    // Do error handling here.
    throw new ApplicationException(string.Format(
        "The {0} assembly could not be registered.",
        assemblyName), ex);

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms