次の方法で共有


BusinessLogicHandler.DotNetAssemblyName Property

ビジネス ロジック ハンドラを実装するアセンブリの名前を取得します。値の設定も可能です。

名前空間: Microsoft.SqlServer.Replication
アセンブリ: Microsoft.SqlServer.Rmo (microsoft.sqlserver.rmo.dll 内)

構文

'宣言
Public Property DotNetAssemblyName As String
public string DotNetAssemblyName { get; set; }
public:
property String^ DotNetAssemblyName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_DotNetAssemblyName ()

/** @property */
public void set_DotNetAssemblyName (String value)
public function get DotNetAssemblyName () : String

public function set DotNetAssemblyName (value : String)

プロパティ値

アセンブリ名を指定する String 値です。

解説

アセンブリがグローバル アセンブリ キャッシュ (GAC) に登録されているか、マージ エージェントの実行可能ファイルと同じディレクトリに配置されているか、マージ エージェントを同期的に起動するアプリケーションと同じディレクトリに配置されていないかぎり、DotNetAssemblyName に設定する値には、アセンブリへの完全なパスが含まれている必要があります。

RegisterBusinessLogicHandler を呼び出す前に、DotNetAssemblyName プロパティを設定する必要があります。

DotNetAssemblyName プロパティは、すべてのユーザーが取得または設定できます。

使用例

// 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);

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\90\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.RegisteredSubscribers
        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

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

BusinessLogicHandler Class
BusinessLogicHandler Members
Microsoft.SqlServer.Replication Namespace