언어

BusinessLogicHandler 클래스

정의

비즈니스 로직 핸들러를 구현하는 관리 코드 어셈블리의 서버 등록을 나타냅니다.

public ref class BusinessLogicHandler sealed
public sealed class BusinessLogicHandler
type BusinessLogicHandler = class
Public NotInheritable Class BusinessLogicHandler
상속
BusinessLogicHandler

예제

// Specify the Distributor name and business logic properties.
string distributorName = publisherInstance;
string assemblyName = @"C:\Program Files\Microsoft SQL Server\110\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);

try
{
    // Connect to the Distributor.
    distributorConn.Connect();

    // 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)
    {
        distributor.RegisterBusinessLogicHandler(customLogic);
    }
}
catch (Exception ex)
{
    // Do error handling here.
    throw new ApplicationException(string.Format(
        "The {0} assembly could not be registered.",
        assemblyName), ex);
}
finally
{
    distributorConn.Disconnect();
}
' Specify the Distributor name and business logic properties.
Dim distributorName As String = publisherInstance
Dim assemblyName As String = "C:\Program Files\Microsoft SQL Server\110\COM\CustomLogic.dll"
Dim className As String = "Microsoft.Samples.SqlServer.BusinessLogicHandler.OrderEntryBusinessLogicHandler"
Dim friendlyName As String = "OrderEntryLogic"

Dim distributor As ReplicationServer
Dim customLogic As BusinessLogicHandler

' Create a connection to the Distributor.
Dim distributorConn As ServerConnection = New ServerConnection(distributorName)

Try
    ' Connect to the Distributor.
    distributorConn.Connect()

    ' 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

    Dim isRegistered As Boolean = False

    ' Check if the business logic handler is already registered at the Distributor.
    For Each registeredLogic As BusinessLogicHandler _
    In distributor.EnumBusinessLogicHandlers
        If registeredLogic Is customLogic Then
            isRegistered = True
        End If
    Next

    ' Register the custom logic.
    If Not isRegistered Then
        distributor.RegisterBusinessLogicHandler(customLogic)
    End If
Catch ex As Exception
    ' Do error handling here.
    Throw New ApplicationException(String.Format( _
     "The {0} assembly could not be registered.", _
     assemblyName), ex)
Finally
    distributorConn.Disconnect()
End Try

설명

비즈니스 로직 핸들러는 호출하여 RegisterBusinessLogicHandler등록됩니다. 객체의 BusinessLogicHandler 속성을 호출 RegisterBusinessLogicHandler하기 전에 반드시 설정되어야 합니다.

비즈니스 로직 핸들러 등록은 .을 호출 UnregisterBusinessLogicHandler하여 제거합니다.

서버에 등록된 비즈니스 로직 핸들러 목록을 받기 위해 호출하세요 EnumBusinessLogicHandlers .

생성자

Name Description
BusinessLogicHandler()

BusinessLogicHandler 클래스의 새 인스턴스를 초기화합니다.

속성

Name Description
DotNetAssemblyName

비즈니스 로직 핸들러를 구현하는 어셈블리 이름을 받거나 설정합니다.

DotNetClassName

비즈니스 로직 핸들러를 구현하는 클래스 이름을 얻거나 설정합니다.

FriendlyName

서버에서 비즈니스 로직 핸들러를 등록하는 이름을 받거나 설정합니다.

IsDotNetAssembly

등록된 비즈니스 로직 핸들러가 관리형 코드 어셈블리인지 여부를 나타내는 값을 받거나 설정합니다.

UserData

사용자가 자신의 데이터를 첨부할 수 있는 객체를 받거나 설정합니다.

메서드

Name Description
CheckValidDefinition(Boolean)

정의가 유효한지 여부를 나타냅니다.

적용 대상

추가 정보