locked
Is there any way to prevent "GetScheme" from setting all syncparameters to DBNULL? RRS feed

  • Question

  • In a current project using Sync Service 1.0 for Devices over WCF where the clients uses SqlCE databases and the server a SQL Server2008.
    I'm passing in a table-valued syncparameter to the server which is used for filtering some of the tables.
    The problem arise when "GetScheme" is called. Since the DbServerSyncProvider.GetSchema() doesn't mind the value of the sync parameters but instead just assign all sqlparameters with "DBNULL". This becomes troublesome since System.Data.SqlClent.SqlParameter.Validate throws an exception:
    "DBNull value for parameter '@ClientWoGuids' is not supported. Table-valued parameters cannot be DBNull."

    Is there any workaround for this or do I just have to make sure that "GetSchema" is never called?
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:29 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, November 27, 2009 10:29 AM

Answers

  • I cannot think of an ideal way to avoid this. the sync services will attemp to call this if a schema of a table is not there.

    What I can suggest is to over write the GetSchema() methods in the WCF contract layer so that you will call the ServerSyncProviders' GetSchema() method and simply return the one you pre-created.

    thanks
    Yunwen
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, November 30, 2009 3:57 PM
    Moderator

All replies

  • I cannot think of an ideal way to avoid this. the sync services will attemp to call this if a schema of a table is not there.

    What I can suggest is to over write the GetSchema() methods in the WCF contract layer so that you will call the ServerSyncProviders' GetSchema() method and simply return the one you pre-created.

    thanks
    Yunwen
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, November 30, 2009 3:57 PM
    Moderator
  • Thank you for your answer.

    I solved it by adding another sync provider that's only called from WCF:s GetSchema(). Since it only will be used to fetch the schema ive added no logic to the sync adapters.

    But your solution is much cleaner, thanks.
    Tuesday, December 1, 2009 7:57 AM