How to expose objects through WCF?

后端 未结 4 656
北恋
北恋 2021-01-21 05:32

My project is split up into a typical 3 layer structure for a Silverlight app. That is:

  • A base layer, which is a class library that contains all my business object
4条回答
  •  情书的邮戳
    2021-01-21 06:22

    It seems that you are expecting internal classes used in the WCF service which you have marked as DataContracts to be exported as .NET objects to your client code (the Silverlight UI). WCF does not support this capability. A class marked as a DataContract is just that, a data structure with no methods. If you need a good resource for undestanding WCF, try Learning WCF: A Hands-on Guide by Michele Bustamente.

    @John Fisher does sketch out a way of exposing .NET objects to both the client & service but this may not be an option for Silverlight. Here is a blog entry explaining how to access REST-based services from Silverlight.

提交回复
热议问题