BusinessLogicHandler Clase
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa el registro del servidor para el ensamblado del código administrado que implementa un controlador de lógica de negocios.
public ref class BusinessLogicHandler sealed
public sealed class BusinessLogicHandler
type BusinessLogicHandler = class
Public NotInheritable Class BusinessLogicHandler
- Herencia
-
BusinessLogicHandler
Ejemplos
// 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
Comentarios
Los controladores de lógica de negocios se registran mediante una llamada a RegisterBusinessLogicHandler. Las propiedades del BusinessLogicHandler objeto deben establecerse antes de llamar a RegisterBusinessLogicHandler.
Los registros del controlador de lógica de negocios se quitan mediante una llamada a UnregisterBusinessLogicHandler.
Llame EnumBusinessLogicHandlers a para obtener una lista de controladores de lógica de negocios registrados en un servidor.
Constructores
BusinessLogicHandler() |
Inicializa una nueva instancia de la clase BusinessLogicHandler. |
Propiedades
DotNetAssemblyName |
Obtiene o establece el nombre del ensamblado que implementa el controlador de la lógica de negocios. |
DotNetClassName |
Obtiene o establece el nombre de la clase que implementa el controlador de la lógica de negocios. |
FriendlyName |
Obtiene o establece el nombre que registra el controlador de lógica de negocios en el servidor. |
IsDotNetAssembly |
Obtiene o establece un valor que indica si el controlador de lógica de negocios registrado es un ensamblado de código administrado. |
UserData |
Obtiene o establece un objeto al que los usuarios pueden adjuntar sus propios datos. |
Métodos
CheckValidDefinition(Boolean) |
Indica si la definición es válida. |