none
Questions about WCF framework for Sync 2.0 in Visual Basic RRS feed

  • Question

  • My prototyping efforts using MSF 2.0 have been fairly successful in helping us figure out how to use the sync framework in our application.  The last part of the prototype will be to incorporate WCF into our server interface.  I have been using the demo application WebSharingAppDemo-SqlProviderEndToEnd as a model for this interface.

    I want to ask two questions.  First, I want to get some feedback to make sure that my understanding of what we need to is correct.  Second, the contract tags for Visual Basic do not entirely match what is shown in the example.  So I need to know what tags to use instead.

    I think I understand what is involved in creating the Proxy class for the server database.  I have to declare an interface that is essentially the same as the IRelationalSyncContract interface for the basic sync function and then I can inherit from that interface to create a second interface to define application-specific calls (like the ISqlSyncContract interface in the example).  Then, I need to implement a wrapper class around each interface.  In the example, RelationalProviderProxy inherits from KnowledgeSyncProvider and implements all of the required (MustOverride) methods of the KnowledgeSyncProvider class.  I believe that I want to use RelationalProviderProxy pretty much as is.

    For the application-specific part of the interface, I need to create a second class that inherits from RelationalProviderProxy and wraps around the application-specific interface (like SqlSyncProviderProxy does in the demo).  This second class will be responsible for creating the actual proxy object.

    That is my understanding of the basic process: create the two interfaces (one of which is basically taken from the demo) and the two proxies (one of which is basically taken from the demo). 

    If that is correct, then here is my second question: what tags do I use in Visual Basic 2005 to define the service contracts?  Most of the tags used in the example have an equivalent tag in VB.  For example, "[ServiceContract]" in C# becomes "<ServiceContract()>" in VB.  Similarly, "[OperationContract]" becomes "<OperationContract()>".

    The part I am having difficulty with is the "data contract".  Here is the declaration in C#:

        [DataContract]
        public class SyncBatchParameters
        {
            [DataMember]
            public SyncKnowledge DestinationKnowledge;

            [DataMember]
            public uint BatchSize;
        }

    I can declare the same object in Visual Basic, but VB 2005 doesn't recognize "<DataContract>" or "<DataMember>".  However, there is a "<DataContractFormat()>" tag.  Is that the equivalent to the C# tags?  If so, then I can code the SyncBatchParameters as:

    <DataContractFormat()> _
    Public Class SyncBatchParameters
        Public DestinationKnowledge As SyncKnowledge
        Public BatchSize As UInt32
    End Class

    Is that correct?  Finally, would anyone happen to know a URL I can go to get all of the tag definitions for defining WCF services?  It might be helpful to look at that.

    Thanks in advance.

     

    Thursday, April 1, 2010 12:29 PM

Answers

  • A quick update: I found the problem on the <DataContract> tag; I had not added System.Runtime.Serialization to my project.  I guess I was expecting the tag to be defined in System.ServiceModel (which is where the ServiceContract tag is defined).

    Thursday, April 1, 2010 1:45 PM

All replies

  • A quick update: I found the problem on the <DataContract> tag; I had not added System.Runtime.Serialization to my project.  I guess I was expecting the tag to be defined in System.ServiceModel (which is where the ServiceContract tag is defined).

    Thursday, April 1, 2010 1:45 PM
  • A quick update: I found the problem on the <DataContract> tag; I had not added System.Runtime.Serialization to my project.  I guess I was expecting the tag to be defined in System.ServiceModel (which is where the ServiceContract tag is defined).

    Thursday, April 1, 2010 1:45 PM