Tech Off Thread

3 posts

Expose a class defined in System.AddIn to WCF

Back to Forum: Tech Off
  • User profile image
    Oggelito

    My WCF Webservice uses the new System.AddIn namespace to support addins.

    I want to expose the class returned by every add-in to my webservice. I believe lots of people would want to do this!

    There are some obstacles;

    •  The class returned to the host is derived from the abstract view class.
    •  The webservice contract needs a class, right, an abstract class or interface as parameter or return type is not allowed.
    •  And the class in question is the host view adapter, which should not be referenced (to keep the independent versioning intact)
    • There will be thousands of objects in an hierarchical array so creating a new object of each would impact performance Sad
    Help!

  • User profile image
    figuerres

    Oggelito wrote:
    My WCF Webservice uses the new System.AddIn namespace to support addins.

    I want to expose the class returned by every add-in to my webservice. I believe lots of people would want to do this!

    There are some obstacles;
    •  The class returned to the host is derived from the abstract view class.
    •  The webservice contract needs a class, right, an abstract class or interface as parameter or return type is not allowed.
    •  And the class in question is the host view adapter, which should not be referenced (to keep the independent versioning intact)
    • There will be thousands of objects in an hierarchical array so creating a new object of each would impact performance
    Help!


    sounds like you have the wrong idea....

    I have to say I am not familiar with the .Addin namespace but I work with soap webservices and am starting to work with WCF bits.

    "Web Services"  are about passing "Messagaes" not "Objects"
    thats #1 to get clear.

    for example if I need to work with a "customer" then I have a customer class that is built to be "serialized" by design. that class will have properties that may be marked to exclude them from serialization so that I am only passing what I have to pass to communicates the "state" of a customer to the other side of the pipe.

    the client can then de-serialize the data into a local "customer" object work with it and then send the "flattened out" data back to the server.

    *IF* you have to pass an "Object Graph" (thats what you are describing btw) then you want to look at say Remoting and at binary serialization.

    but passing an object graph can be a hassle...




  • User profile image
    Oggelito

    Allright, thanks for the information.

    edit: I don't think I can conform to pure messages.

    I have a feeling it means getting rid of the self-referenced array

    This is my "object graph" (simplified but still) :

    namespace ImportExport.ServiceContracts
    {
        [DataContract]
        public class DataResult
        {
            [DataMember]
            public string Name { get; set; }

            [DataMember]
            public float Value { get; set; }

            [DataMember]
            public DataResult[] Children { get; set; }

        }
    }

    I will make both the abstract host view class and interface class conform to a xsd-schema and serialize/deserialize in the webmethod.

    that will have to do...

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.