Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

BusinessLogicHandler Class

 

Applies To: SQL Server 2016 Preview

Represents the server registration for the managed code assembly that implements a business logic handler.

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

System.Object
  Microsoft.SqlServer.Replication.BusinessLogicHandler

public sealed class BusinessLogicHandler

NameDescription
System_CAPS_pubmethodBusinessLogicHandler()

Initializes a new instance of the BusinessLogicHandler class.

NameDescription
System_CAPS_pubpropertyDotNetAssemblyName

Gets or sets the name of the assembly that implements the business logic handler.

System_CAPS_pubpropertyDotNetClassName

Gets or sets the name of the class that implements the business logic handler.

System_CAPS_pubpropertyFriendlyName

Gets or sets the name that registers the business logic handler on the server.

System_CAPS_pubpropertyIsDotNetAssembly

Gets or sets a value that indicates whether the registered business logic handler is a managed code assembly.

System_CAPS_pubpropertyUserData

Gets or sets an object to which users can attach their own data.

NameDescription
System_CAPS_pubmethodCheckValidDefinition(Boolean)

This API supports the product infrastructure and is not intended to be used directly from your code. Indicates whether the definition is valid.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

Business logic handlers are registered by calling RegisterBusinessLogicHandler. The properties of the BusinessLogicHandler object must be set before calling RegisterBusinessLogicHandler.

Business logic handler registrations are removed by calling UnregisterBusinessLogicHandler.

Call EnumBusinessLogicHandlers to get a list of business logic handlers that are registered on a server.

Legacy Code Example

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

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

Return to top

Community Additions

Show:
© 2015 Microsoft