locked
SQL Server Express Provider RRS feed

  • Question

  • Hey guys,

    I'm new to sync, wondering if there is a SQL Server provider out there written for VS 2008 and C# Local Data Cashe or if anyone knows how to write it? or tutorials?

    I know VS 2008 can do SQL Compact Express but I need a bigger database and am using SQL Express. Please help.

    Stephen
    • Moved by Liam Cavanagh - MSFTMicrosoft employee Tuesday, September 29, 2009 9:49 PM (From:SyncFx - General)
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:37 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Tuesday, September 29, 2009 5:41 PM

Answers

  • Hi,

    If you want a solution to automatically figure out which set of tables in your database should be synced, it is not a problem that Microsoft Sync Framework can help here because it doesn't know your business logics.

    If you expect to sync all tables in a database, you can write a SQL script to get all table names and the column info of each table from the SQL server SCINFORMATION_SCHEMA or ADO.Net connection.GetSchema API.

    If you don't like to write hundreds of similiar code snippets to create different syncTables and syncAdapters for hundreds of tables, you can write one or two helper methods to do so by consuming the list of tables one by one and add each of them into the SyncAgent.Configuration.SyncTables and serverSyncProvider.SyncAdapters. I don't see many hard code if you try this way. Because the sample only used two tables, it didn't try to optimize this part. But it should be easy to refactor the code when you have more tables.

    Thanks,
    Dong
    This posting is provided AS IS with no warranties, and confers no rights.
    Thursday, October 29, 2009 6:02 AM
    Moderator

All replies

  • Hi Stephen,

    it is recommended to use the shipping providers for the server to server ( sqlexpress ). the current CTP is avaiable for downlaod at http://www.microsoft.com/downloads/details.aspx?FamilyID=89adbb1e-53ff-41b5-ba17-8e43a2e66254&displaylang=en

    the BOL has the essential info that you can get started with MSF. Please do let us know should you have questions on the sync services or the sync framework in genernal.

    thanks
    Yunwen
    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Proposed as answer by Yunwen BaiModerator Wednesday, September 30, 2009 11:25 AM
    • Unproposed as answer by Tammo7 Wednesday, September 30, 2009 5:57 PM
    Wednesday, September 30, 2009 11:24 AM
    Moderator
  • Yes Yunwen, I discovered these before I posted but my confustion is how do i get started. I'm completely at a loss, I need a tutorial for MSF would be best.

    Stephen
    Wednesday, September 30, 2009 11:54 AM
  • I been using this example

    http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=1200

    But I don't know what exactly is going on, to me it looks like I have to hard code every tables name in to the SyncEngine.cs, this is not reasonable because i have hundreds of tables.

    Stephen
    Wednesday, September 30, 2009 5:56 PM
  • Hi,

    You may also consider using SqlSyncProvider for SQL Express instead. It has provisioning APIs that can generate SQL commands as stored procedures for you. You must tell sync which set of tables that you need to sync. The table names are necessary info to give. 

    Thanks,
    Dong 


    This posting is provided AS IS with no warranties, and confers no rights.
    Tuesday, October 27, 2009 6:30 PM
    Moderator
  • Yes but this requires to much hard coding and will cost alot of time maintaining. I'm still looking into an answer for this.
    Wednesday, October 28, 2009 5:38 PM
  • Hi,

    If you want a solution to automatically figure out which set of tables in your database should be synced, it is not a problem that Microsoft Sync Framework can help here because it doesn't know your business logics.

    If you expect to sync all tables in a database, you can write a SQL script to get all table names and the column info of each table from the SQL server SCINFORMATION_SCHEMA or ADO.Net connection.GetSchema API.

    If you don't like to write hundreds of similiar code snippets to create different syncTables and syncAdapters for hundreds of tables, you can write one or two helper methods to do so by consuming the list of tables one by one and add each of them into the SyncAgent.Configuration.SyncTables and serverSyncProvider.SyncAdapters. I don't see many hard code if you try this way. Because the sample only used two tables, it didn't try to optimize this part. But it should be easy to refactor the code when you have more tables.

    Thanks,
    Dong
    This posting is provided AS IS with no warranties, and confers no rights.
    Thursday, October 29, 2009 6:02 AM
    Moderator
  • Sounds as good as I can get it! Do you have or known of any coding examples to get me started in the right direction?
    Thursday, October 29, 2009 11:04 AM
  • We currently sync approximately 60 tables between SQL Express and SQL 2008. In order keep from hand coding everything we gathered all the table information into XML files that defined the tables, filters, columns, etc. that need to be sync'd.

    You probably could script something that would generate a list of your tables into an XML file and then load that and assign the tables accordingly to the SyncAdapter.
    Thursday, October 29, 2009 4:13 PM
  • Are there any examples to hook up to sql express as a client?  What specific provider do you use?
    Thursday, October 29, 2009 4:45 PM
  • Thursday, October 29, 2009 5:11 PM
  • thanks, i'll check it out!
    Thursday, October 29, 2009 10:00 PM
  • Have any luck understanding the example? I haven't had a chance to play with it.
    Monday, November 2, 2009 5:37 PM
  • Hi Guys , i have a task to perform , i have a local DB , and remote (web hosted DB) i want cretin tables (ex contacts , address , telephones)to be in Sync in both DB's , they Sql Server 2005 what is the easiest way to do so using MS Sync FX
    Monday, November 16, 2009 2:31 PM