Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_registercustomresolver

  No additional text.


Syntax

-- Name: sp_registercustomresolver

-- Description:  This procedure registers custom resolvers into the MSmerge_articleresolver table in the distribution database
--                     This proc should be called in the context of the distribution database

-- Parameters:
--     1. @article_resolver     nvarchar(255)
--        This parameter contains the friendly name of the custom resolver or business logic handler
--     2. @resolver_clsid     nvarchar(50),
--        This parameter must be set to a valid CLSID if registering a COM resolver and to NULL while registering a .NET Framework Assembly
--     3. @is_dotnet_assembly nvarchar(10)
--        This parameter must be set to TRUE while registering a .NET Framework Assembly and false otherwise
--     4. @dotnet_assembly_name  nvarchar(255)
--        For business logic handlers which are .NET assemblies, this parameter either contains the name of the .NET Assembly such as
--        "Sample Business Logic Module For Shippers.dll" if the .NET assembly is deployed into the same directory as the
--        merge agent. Optionally a fully qualified name such as 'C:\Assemblies\COM\Resources\Sample Business Logic Module For Shippers.dll'
--        must be provided that allows the merge agent to load the .NET assembly using the fully qualified path name.
--     5. @dotnet_class_name  nvarchar(255)
--        For business logic handlers which are .NET assemblies, this parameter either contains the name of the .NET class that implements
--        the BusinessLogicModule class such as "Microsoft.Samples.SqlServer.Replication.BusinessLogicHandler.OrderEntryBusinessLogicHandler"


create procedure sys.sp_registercustomresolver
    @article_resolver nvarchar(255),
    @resolver_clsid nvarchar(50) = NULL,         -- This must be set to a valid CLSID if registering a COM resolver and to NULL for a .NET Framework Assembly
    @is_dotnet_assembly nvarchar(10) = 'false',  -- This flag must be set to TRUE while registering a .NET Framework Assembly
    @dotnet_assembly_name  nvarchar(255) = NULL, -- For .NET Framework Assemblies, this parameter must be set to the name of the .NET assembly that implements the BusinessLogicModule class
    @dotnet_class_name  nvarchar(255) = NULL    -- For .NET Framework Assemblies, this parameter must be set to the name of the .NET class that implements the BusinessLogicModule class

    AS

    declare @retcode       int

    exec @retcode = sys.sp_MSreplcheck_publish
    if (@retcode <> 0 or @@error <> 0)
        return 1

    if @article_resolver IS NULL or @article_resolver = ''
    begin
        RAISERROR (21717, 16, -1)
        return 1
    end

    if LOWER(@is_dotnet_assembly collate SQL_Latin1_General_CP1_CS_AS) NOT IN ('true', 'false')
    BEGIN
        RAISERROR (14137, 16, -1)
           return 1
    END

    if LOWER(@is_dotnet_assembly collate SQL_Latin1_General_CP1_CS_AS) = 'true'
    begin
        if @resolver_clsid IS NOT NULL
        begin
            RAISERROR (21807, 16, -1)
            return 1
        end
        if @dotnet_assembly_name IS NULL or @dotnet_assembly_name = ''
        begin
            RAISERROR (21856, 16, -1, @article_resolver)
            return 1
        end
        if @dotnet_class_name IS NULL or @dotnet_class_name = ''
        begin
            RAISERROR (21808, 16, -1, @article_resolver)
            return 1
        end
        set @resolver_clsid = '00000000-0000-0000-0000-000000000000'
    end
    else
    begin
        if @resolver_clsid IS NULL or @resolver_clsid = ''
        begin
            RAISERROR (21718, 16, -1)
            return 1
        end
    end

    --this proc can only execute in the distribution database context
    if object_id (N'MSmerge_articleresolver') is null
    begin
        raiserror(25026, 16, -1)
        return 1
    end


    --Insert a new row into MSmerge_articleresolver if the resolver does not exist, otherwise, update it.
    if LOWER(@is_dotnet_assembly collate SQL_Latin1_General_CP1_CS_AS) = 'true'
    begin
         -- in the case when the resolver is a .NET resolver
         if not exists( select * from dbo.MSmerge_articleresolver where article_resolver = @article_resolver)
            insert into dbo.MSmerge_articleresolver( article_resolver, resolver_clsid, is_dotnet_assembly, dotnet_assembly_name, dotnet_class_name)
            values( @article_resolver, @resolver_clsid, 1, @dotnet_assembly_name, @dotnet_class_name)
        else
            update dbo.MSmerge_articleresolver
            set resolver_clsid = @resolver_clsid,
                 is_dotnet_assembly = 1,
                 dotnet_assembly_name = @dotnet_assembly_name,
                 dotnet_class_name = @dotnet_class_name
            where article_resolver = @article_resolver

    end
    else
    begin
     -- in the case when the resolver is not a .NET resolver
         if not exists( select * from  dbo.MSmerge_articleresolver where article_resolver = @article_resolver)
            insert into dbo.MSmerge_articleresolver( article_resolver, resolver_clsid, is_dotnet_assembly, dotnet_assembly_name, dotnet_class_name)
            values( @article_resolver, @resolver_clsid, 0, NULL, NULL)
        else
            update dbo.MSmerge_articleresolver
            set resolver_clsid = @resolver_clsid,
                 is_dotnet_assembly = 0,
                 dotnet_assembly_name = NULL,
                 dotnet_class_name = NULL
            where article_resolver = @article_resolver
    end

    return @retcode

 
Last revision 2008RTM
See also

  sp_MSdrop_rladmin (Procedure)
sp_MSrepl_register_default_resolvers (Procedure)
sp_vupgrade_registry_custom_resolver_katmai (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash