Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

concur/couchbase-interop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

couchbase-interop

Overview

This project wraps Official Couchbase .NET SDK with classes providing COM interface. The main goal is to make Couchbase available for Classic ASP applications. However any legacy application capable of consuming COM objects can benefit from this SDK.

Due to missing support for JSON format in legacy applications, the COM API does not offer full range of methods like typical Couchbase 2.0 SDK. Instead it's focusing on the basic Memcached operations which can be easily used by all legacy applications.

Versioning

The first 3 digits (Major, Minior, Build) of Couchbase.ComClient.dll will always reflect the version of Couchbase.NetClient.dll it is based upon. The last digit (Revision) may be used if patch for COM SDK is required without update of the underlying .NET SDK.

Dependencies

This project requires several NuGet packages as dependencies. For a complete list please refer to packages.config. Because of the fundaments of COM - .NET Interoperability, there is no app.config file available to handle .NET assembly redirection. For this reason all shared dependencies must all sync on one exact version to be used through out the project.

For example if Couchbase.NetClient.dll references Common.Logging version 3.0.0, the Couchbase.ComClient can not reference Common.Logging version 3.1.0.

Deployment

The easiest deployment model is to register Couchbase.ComClient and all its dependencies into GAC through Gacutil tool. After that you can register the COM interfaces with Regasm. This deployment model will ensure that the COM object assembly and its dependencies are always available and can be easily updated at any time.

Alternatively you can avoid usage of GAC if you use /codebase argument in Regasm. In this case make sure that the path you used to register COM components contains all required dependencies in their correct versions and that it's accessible by consuming applications.

Example script with GAC deployment: com-register.cmd

Usage Example

dim logConfig, factory, bucket, result

set logConfig = CreateObject("Couchbase.ComClient.LogConfig")
logConfig.FileName = "example.log"
call logConfig.SetupLogging()
set logConfig = nothing

set factory = CreateObject("Couchbase.ComClient.BucketFactory")
call factory.ConfigureCluster("example.config", "local")
set bucket = factory.GetBucket("default")

set result = bucket.Upsert("testkey", "Hello World!", 60)
call WScript.StdOut.WriteLine("Upsert call success: " & result.Success)
set result = nothing

call factory.CloseBucket("default")
set bucket = nothing
factory.CloseCluster("local")
set factory = nothing

COM API