locked
trying to run the sample example provided in codeplex RRS feed

  • Question

  • Hi ,

    i am using sync framework 2.1 and trying to run the sample provided in codeplex

    Database Sync - SQL Server and SQL Compact 2-Tier

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

    i did every thing as in documentation, but i am getting the following error can any one help

    base {Microsoft.Synchronization.SyncException} = {"The Configuration method is currently not supported by RelationalSyncProvider.  The Sync Framework database providers do not support this feature.  This feature is available by implementing a custom provider."}

     

    need ur suggestions

     

     

     

    Sunday, October 24, 2010 11:50 PM

Answers

  • Hi,

    It is not SyncFx related. The current SQL to SQLCE sync sample doesn't implement this capability in its UI control - TablesViewControl.cs. The changes in the grid table are not persisted to SQL table at all. If you want to get it to work, please look at the implementation in another Sync sample- SQL to SQL Express sync (http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3762). Its TableViewControl enabled this editing.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, October 27, 2010 11:27 PM

All replies

  • can you confirm that you project references are pointing to the v2.1 assemblies?
    Monday, October 25, 2010 1:57 AM
  • Hi,

    yes the project references are pointing to v2.1 assemblies.

     

    except system,system.data every thing is pointing to v2.1

    Monday, October 25, 2010 2:39 AM
  • can you post the exact stack trace?
    Monday, October 25, 2010 3:51 AM
  • I cannot repro this failure. Did you modify the sample code at all? If you explicitly called SqlSyncProvider.Configuration or SqlCeSyncProvider.Configuration, you are expected to see this exception.

    As JuneT said, please share us the call stack.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, October 25, 2010 10:01 PM
  • hi please see below the trace

     

    The assembly with display name 'Microsoft.Synchronization.Data.SqlServer.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Synchronization.Data.SqlServer.XmlSerializers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    File name: 'Microsoft.Synchronization.Data.SqlServer.XmlSerializers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'

     

    === Pre-bind state information ===

    LOG: User = user

    LOG: DisplayName = Microsoft.Synchronization.Data.SqlServer.XmlSerializers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL

     (Fully-specified)

    LOG: Appbase = file:///C:/Documents and Settings/user/Desktop/new/SharingAppDemo-CEProviderEndToEnd/bin/Debug/

    LOG: Initial PrivatePath = NULL

    Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.

    ===

    LOG: This bind starts in default load context.

    LOG: Using application configuration file: C:\Documents and Settings\user\Desktop\new\SharingAppDemo-CEProviderEndToEnd\bin\Debug\SyncApplication.exe.Config

    LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.

    LOG: Post-policy reference: Microsoft.Synchronization.Data.SqlServer.XmlSerializers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL

    LOG: Attempting download of new URL file:///C:/Documents and Settings/user/Desktop/new/SharingAppDemo-CEProviderEndToEnd/bin/Debug/Microsoft.Synchronization.Data.SqlServer.XmlSerializers.DLL.

    LOG: Attempting download of new URL file:///C:/Documents and Settings/user/Desktop/new/SharingAppDemo-CEProviderEndToEnd/bin/Debug/Microsoft.Synchronization.Data.SqlServer.XmlSerializers/Microsoft.Synchronization.Data.SqlServer.XmlSerializers.DLL.

    LOG: Attempting download of new URL file:///C:/Documents and Settings/user/Desktop/new/SharingAppDemo-CEProviderEndToEnd/bin/Debug/Microsoft.Synchronization.Data.SqlServer.XmlSerializers.EXE.

    LOG: Attempting download of new URL file:///C:/Documents and Settings/user/Desktop/new/SharingAppDemo-CEProviderEndToEnd/bin/Debug/Microsoft.Synchronization.Data.SqlServer.XmlSerializers/Microsoft.Synchronization.Data.SqlServer.XmlSerializers.EXE.

     

    Wednesday, October 27, 2010 2:24 AM
  • any suggestions?
    Wednesday, October 27, 2010 2:17 PM
  • Hi,

    I guess that you ran the sample with VS.NET debugger attached and enabled debugger to catch all .net exceptions. Please ignore this .net exception and let the sample to continue. It should just work. If you see any issues that really fail the sample app, please let us know.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, October 27, 2010 5:17 PM
  • hi Dong,

    tnx for your reply... my main issue is the sample is running fine... i am able to retrieve data from server(sql 2008 db) and  client (compact db) but when i try to synchronize after making some changes in the GUI it is not synchronizing.

     

     

     

    if i make changes in the server (orders table) database and hit synchronize it is working fine...

    i dont know why it is not synching when i try to change it in GUI(form)

     

    hope to get some suggestions

    Wednesday, October 27, 2010 5:35 PM
  • Hi,

    It is not SyncFx related. The current SQL to SQLCE sync sample doesn't implement this capability in its UI control - TablesViewControl.cs. The changes in the grid table are not persisted to SQL table at all. If you want to get it to work, please look at the implementation in another Sync sample- SQL to SQL Express sync (http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3762). Its TableViewControl enabled this editing.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, October 27, 2010 11:27 PM
  • Hi,

    i am using the same example.... now i have added a new table orders_filter to my sql server, and added that to the scope(sales), and updated the code.

    i am trying to implement dynamic filters, before that i just want to see the tables in server(sql server) and client(sql CE).

     

    but i am getting the following error, when i try to add CE Client from front end.

     

    The specified table does not exitst. [orders _filter] 

     

    please let me know how to updte the CE client with the table.

    Sunday, December 12, 2010 12:16 AM
  • would you mind posting the code snippet for the provisioning part where you added the table to the scope? and the provisioning code on the client as well?
    Monday, December 13, 2010 3:21 PM
  • Hi ,

    Please see below the code snipet...basically i added a new table(order_filter) and trying to figure out how passing dynamic filters work.

    i am using the example from your blog

    http://jtabadero.wordpress.com/

    i am getting the following error

    Cannot add filter column 'originstate' because the table '[orders_filter]' does not contain a column that has that name.
    Ensure that you specify the correct values for DbSyncTableDescription.Columns and SqlSyncTableP

       public SqlSyncProvider ConfigureSqlSyncProvider(string hostName)
        {
          SqlSyncProvider provider = new SqlSyncProvider();
          provider.ScopeName = SyncUtils.ScopeName;
    
          SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
          builder.DataSource = hostName;
          builder.IntegratedSecurity = true;
          builder.InitialCatalog = "peer1";
          builder.ConnectTimeout = 1;
          provider.Connection = new SqlConnection(builder.ToString());
    
          // Create a template named "Orders_OriginState_Filter_template"
          DbSyncScopeDescription scopeDesc1 = new DbSyncScopeDescription("Orders_OriginState_Filter_template");
    
          // Definition for tables.
          scopeDesc1.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("orders_filter", (System.Data.SqlClient.SqlConnection)provider.Connection));
    
          // Create a provisioning object for "Orders_OriginState_Filter_template" that can be used to create a template
          // from which filtered synchronization scopes can be created.
          SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning((System.Data.SqlClient.SqlConnection)provider.Connection, scopeDesc1, SqlSyncScopeProvisioningType.Template);
    
          serverTemplate.Tables["orders_filter"].AddFilterColumn("originstate");
          
          serverTemplate.Tables["orders_filter"].FilterClause = "[side].[OriginState] = @originState";
          SqlParameter param = new SqlParameter("@originState", SqlDbType.NVarChar, 2);
          serverTemplate.Tables["orders_filter"].FilterParameters.Add(param);
    
    
          // create a new select changes stored proc for this scope
          serverTemplate.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
    
          // Create the "Orders_OriginState_Filter_template" template in the database.
          serverTemplate.Apply();
    
    
    
    
    
    
          //create a new scope description and add the appropriate tables to this scope
          DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(SyncUtils.ScopeName);
          
    
          //class to be used to provision the scope defined above
          SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning((System.Data.SqlClient.SqlConnection)provider.Connection);
    
          //determine if this scope already exists on the server and if not go ahead and provision
          //if (!serverConfig.ScopeExists(SyncUtils.ScopeName))
          if (!serverConfig.ScopeExists(SyncUtils.ScopeName))
          {
    
    
            serverConfig.PopulateFromTemplate("sales", "Orders_OriginState_Filter_template");
            serverConfig.Tables["orders_filter"].FilterParameters["@originState"].Value = "VA";
            serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
            serverConfig.Apply();
            
            ////add the approrpiate tables to this scope
            //scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("orders",(System.Data.SqlClient.SqlConnection)provider.Connection));
            //scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("order_details",(System.Data.SqlClient.SqlConnection)provider.Connection));
            //scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("orders_filter", (System.Data.SqlClient.SqlConnection)provider.Connection));
    
            ////note that it is important to call this after the tables have been added to the scope
            //serverConfig.PopulateFromScopeDescription(scopeDesc);
    
            ////indicate that the base table already exists and does not need to be created
            //serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
    
            ////provision the server
            //serverConfig.Apply();
          }      
          
         
          //Register the BatchSpooled and BatchApplied events. These are fired when a provider is either enumerating or applying changes in batches.
          provider.BatchApplied += new EventHandler<DbBatchAppliedEventArgs>(provider_BatchApplied);
          provider.BatchSpooled += new EventHandler<DbBatchSpooledEventArgs>(provider_BatchSpooled);
    
          return provider;
        }
    Friday, December 17, 2010 9:40 PM
  • Hi,

      If we are having any schema changes in source db, the sync previously provisioned object cannot identify the changes hence the sync will fail. To overcome this problem we need to deprovision entire db once we are having any schema changes in the source db. To deprovision entire db there is a method "DeprovisionStore" in class "SqlSyncScopeDeprovisioning ".

    SqlSyncScopeDeprovisioning deprovisioningvar = new SqlSyncScopeDeprovisioning(sqlServerConn);
    deprovisioningvar.DeprovisionStore();

    For details pls refer http://tuvian.wordpress.com/2011/05/04/how-to-sync-schema-changed-database-using-sync-framework/#respond 

     

    Tuesday, May 10, 2011 5:17 AM
  • The error is raised due to the fact that the column name 'originstate' which is specified as a filter column is not in proper case. The source table contains the column name 'originstate' in a different case. This name case problem is only observed when the column name is added in the filter column collections.

    Friday, December 14, 2012 7:22 AM
  • you must have configured your database then as case sensitive...
    Friday, December 14, 2012 9:25 AM