Click here to Skip to main content
12,553,968 members (64,040 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked

Integrate Version Control to Your ECM Application

, 26 Mar 2013 CPOL
Integrate Version Control to Your ECM Application

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.


SourceAnywhere is a SQL Server based version control tool. It is a light yet powerful tool designed for local and remote development teams. The tool provides different kinds of clients, including the GUI client, IDE plug-ins and the Java Client, in order to satisfy various requirements and to adapt to different development environments.

One of the version control clients, the SDK client of SourceAnywhere, allows you to embed the version control features - such as check-in, check-out, get, share, branch and more - into your own applications as well as incorporate file versioning to the workflow of your system automatically. For example, within an Enterprise content management (ECM) system, you can submit the documents to the source control database where the history changes of the files will be kept and specific versions can be retrieved as needed.

If you are interested in SourceAnywhere, the 30-day free trial can be downloaded from Dynamsoft’s website. The COM/Java SDK, along with the other clients, is available on the download page.

Key Features

  • Various source control clients, including the GUI client, SDK, and plug-ins for IDEs, are provided for access and management of your data.
  • Robust: be able to handle 500+ concurrent connections globally.
  • Efficient: unique caching mechanism to boost up the version control performance.
  • Secure: with SSL, Blowfish encryption, password policy and database encryption, your data is in good hands.

In this article, I’ll show you how to integrate SourceAnywhere to your own application and customize the version control operations.

1. Embed SourceAnywhere to your application

Let’s take a Visual Studio C# program as an example. In the Solution Explorer click menu Project | Add Reference | Browse, select "SAWSSDK.dll" in the installation folder of SourceAnywhere COM SDK and click OK.

2. Connect to the database

Call ConnectToServer to connect to the remote server. You can define the target server and whether or not to connect through the proxy server.

After successfully connecting to the server, you can specify your user name, password and the target database and repository in the Login property.

The following sample code will let you connect and access the demo server provided by Dynamsoft. The server and login info can be found below:

Port: 7777

User name: dynamsoft1
Password: saw

You can also check out the SourceAnywhere Online Demo page to learn the details.

private void Connect_Click(object sender, EventArgs e)
    string ServerIP = "";
    int ServerPort = 7777;
    bool OnlyTrial;
    SAWSSDKLib.Enum_EncryptType EncryptType;
    int LeftTrialDays;
    bool RealServer;
    bool Cancelled;
    string ResultDescription;
    string DBServerName;
    string DBName;

    long ResultValue;
    ResultValue = sdkObject.ConnectToServer(ServerIP, ServerPort, Enum_ProxyType.Enum_NOPROXY, "", 0, "", "", false, "", out EncryptType, out  OnlyTrial, out LeftTrialDays, out RealServer, out DBServerName, out DBName, out Cancelled, out ResultDescription);

    if (ResultValue != 0)
        MessageBox.Show("Failed to connect to server");
        SAWSSDKLib.SAWSKeyFileSet KeyFileSet = new SAWSKeyFileSet();
        bool MustChangePassword;
        int DayOfExpiration;

        long ResultValue1;
        ResultValue1 = sdkObject.Login("dynamsoft1", "saw", "", "default", KeyFileSet, out MustChangePassword, out DayOfExpiration, out Cancelled, out ResultDescription);

        if (ResultValue1 != 0)
            MessageBox.Show("Failed to log in");
            MessageBox.Show("Log in successfully");


3. Check out a file

After connecting to the server, the following sample code enables you to check out the file "$/test/local.txt" from the version control tool. Use CheckOutFile.LocalFileName to define the check out folder.

private void CheckOut_Click(object sender, EventArgs e)
    SAWSSDKLib.SAWSCheckoutFileSet CheckOutFileSet = new SAWSCheckoutFileSet();
    SAWSSDKLib.SAWSDiffMergeParam MergeParam = new SAWSDiffMergeParam();
    bool Cancelled;
    string ResultDiscription;
    SAWSSDKLib.SAWSOperationResultSet OperationResultSet = new SAWSOperationResultSet();

    SAWSSDKLib.SAWSCheckoutFile CheckOutFile = new SAWSCheckoutFile();
    CheckOutFile.FileToCheckout = "$/test/local.txt";
    CheckOutFile.LocalFileName = "D:\\Temp\\1.txt";

    long ResultValue;
    ResultValue = sdkObject.CheckoutFiles(CheckOutFileSet, true, "", false, Enum_ModifiedFileHandling.Enum_AskModifiedFile, Enum_EOL.Enum_EOLNative, Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_SetLocalFileTime.Enum_SetLocalFileTimeModification, MergeParam, out Cancelled, out ResultDiscription, out OperationResultSet);

    if (ResultValue != 0)
        MessageBox.Show("Check out failed");
        MessageBox.Show("Check out successfully");

4. Check in a file

After modifying the checked out file, you can use CheckInFiles to check in the file from your folder.

CheckInFile.FileToCheckin specifies the file planned to be checked in. CheckInFile.LocalFileName specifies the check out folder.

private void CheckIn_Click(object sender, EventArgs e)
    SAWSSDKLib.SAWSCheckinFileSet CheckinFileSet = new SAWSCheckinFileSet();
    SAWSSDKLib.SAWSCheckinFile CheckInFile = new SAWSCheckinFile();
    CheckInFile.FileToCheckin = "$/test/local.txt";
    CheckInFile.LocalFileName = "D:\\temp\\1.txt";

    SAWSSDKLib.SAWSDiffMergeParam MergeParam = new SAWSDiffMergeParam();
    bool Cancelled;
    string ResultDescription;
    SAWSSDKLib.SAWSOperationResultSet OperationResultSet = new SAWSOperationResultSet();

    long ResultValue;
    ResultValue = sdkObject.CheckInFiles(CheckinFileSet, false, false, Enum_CompareFileBy.Enum_CompareFileByChecksum, Enum_EOL.Enum_EOLNative, true, false, Enum_SetLocalFileTime.Enum_SetLocalFileTimeModification, Enum_CheckinUnchangedFileHandling.Enum_AskCheckinUnchangedFile, "", MergeParam, out Cancelled, out ResultDescription, out OperationResultSet);

    if (ResultValue != 0)
        MessageBox.Show("Check in failed");
        MessageBox.Show("Check in successfully.");

Besides the features showed above, operations, such as Label, Show History, Share and Branch, are also supported by the SourceAnywhere SDK Client. You can fully customize the application based on your requirements.


To play with the SDK by yourself, you can download the 30-day free trial from Dynamsoft’s website.

SourceAnywhere 30-Day Free Trial

The online demo is also available for you.

SourceAnywhere Guide & Online Demo


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Canada Canada
Dynamsoft has more than 10 years of experience in TWAIN SDKs, imaging SDKs and version control solutions.

Our products include:

- Dynamic Web TWAIN: a TWAIN scanning SDK optimized for web document management applications.
- Dynamic .NET TWAIN: a .NET TWAIN and Directshow Image Capture SDK for WinForms/WPF applications.

Imaging SDKs
- Barcode Reader for Windows, Linux, macOS, iOS, Android and Raspberry Pi.
- OCR addon for both web and .NET TWAIN SDKs

Version Control
- SourceAnywhere: a SQL server-based source control solution. Both on-premise and hosting options are provided.
Group type: Organisation

18 members

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161021.1 | Last Updated 26 Mar 2013
Article Copyright 2013 by Dynamsoft
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid