Giter VIP home page Giter VIP logo

sqlcemergelib's Introduction

What is it?

This library simplifies the code to do Merge Replication from a SQL Server Compact 3.5 SP2 client, with useful helper methods

Features:

  • Is intended for use from a WinForms or WPF application, and the Synchronize method runs async.
  • Implements best practices for optimal performance, and attempt to properly detect expired subscriptions, by throwing a PublicationMayHaveExpiredException.
  • Will create the database file for you as required, so an existing database file is not required.
  • Optionally logs sync status to a SyncLog table (which is a part of the publication)
  • Generate INSERT script in order to rescue local data in case of a disaster (for example publication expiry)
  • Validate a Publication, for example after initial Sync
  • Properly format a SqlCeException as a string to get all available error information
  • Source includes a demo form to test parameters and see the library in action
  • Exposes the settings described in the Rob Tiffany "cheat sheet"

How do I get it?

Download the NuGet package

How do I use it?

Online API documentation

Sample WinForms app

using ErikEJ.SqlCeMergeLib;
using System.Data.SqlServerCe;
...
string sdfFile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MergeTest.sdf");
conn = new SqlCeConnection(string.Format("Data Source={0}", sdfFile));

DateTime syncDate = sync.GetLastSuccessfulSyncTime(conn);
textBox1.Text = "Last Sync: " + syncDate.ToString();

sync.Completed += SyncCompletedEvent;
sync.Progress += SyncProgressEvent;
sync.Synchronize(conn, 1002, 1);

Other useful methods:

Generate INSERT script for the local database (for disaster recovery):

public string GenerateInsertScripts (
        SqlCeConnection connection,
        List<string> tableNames
) 

Format a SqlCeException as a String:

public string ShowErrors (
        SqlCeException e
) 

Validate that the local database is properly Merge Replicated;

public bool Validate (
        SqlCeConnection connection
) 

Configuration:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="InternetLogin" value=""/>
    <add key="InternetPassword" value=""/>
    <add key="InternetUrl" value="http://erik-pc/ssce35sync/sqlcesa35.dll"/>
    <add key="Publication" value="PubPostCodes"/>
    <add key="Publisher" value="Erik-PC\SQL2008R2"/>
    <add key="PublisherDatabase" value="PostCodes"/>
    <add key="PublisherLogin" value="sa"/>
    <add key="PublisherPassword" value="pw"/>
    <add key="UseNT" value="false"/>
  </appSettings>
</configuration>

Screenshot

sqlcemergelib's People

Contributors

erikej avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

sqlcemergelib's Issues

Codeplex move tasks

  • Update readme
  • add .gitignore file
  • Move docs and publish as github pages
  • Add files to releases
  • Move the issue!
  • Tweet!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.