Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 330291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:40:03+00:00 2026-05-12T09:40:03+00:00

Suppose I have a WCF service and a method in the contract <ServiceContract()> _

  • 0

Suppose I have a WCF service and a method in the contract

<ServiceContract()> _
Interface IThingService
'...
  <OperationContract()> _
  Function GetThing(thingId As Guid) As Thing
End Interface

where Thing is an ordinary class with ordinary properties, except for one member:

Public Class Thing
  ' ...
  Public Property Photos() As Dictionary(Of String, Photo) 
  ' ...
End Class

where Photo is an ordinary class with ordinary properties.

So I dove into some documentation such as this MSDN article, and this blog post, and now I am confused if I have to understand a lot about the DataContractSerializer and the particulars of how the service serializes the Photos property.

Do I need to go there, or is there something I can do to let WCF on the server interact with my client automatically? Seems to me all the serialization details should be able to be abstracted away–I just want to end up, in the consuming client app, with:

Dim foo as Thing = ThingServiceClient.GetThing(someGuid)
Dim myPhotos as Dictionary(Of String, Photo) = foo.Photos

What do I need to do in my definition of Thing to make this work? Anything I need to do elsewhere to get this to work? Do I need to worry about ensuring the service sticks to the DataContractSerializer and doesn’t fall back to use the XmlSerializer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:40:03+00:00Added an answer on May 12, 2026 at 9:40 am

    I would be careful with exposing you business objects directly in a WCF contract (or an asmx web service, or any other external entry point into the system). This is an interface that your external systems use, and such an interface should stay constant even though your business objects change internally. There can also be functions on the business object that makes sense on the server, but not on the client.

    Also, you suddenly need to modify you bussiness objects so that it fits you communication technology of choice, e.g. you have to put attributes on you business class, attributes that really has nothing to do with the business class.

    I would create a ThingDTO (DTO = data transfer object) that contain the data to transfer to the client, and initialize it with the data from a Thing instance. That means that if you consider you WCF service to be a facade to the system, the ThingDTO is then part of your facade layer. And therefore attributes to control WCF serialization can go freely in here.

    That said, it is not the same as that it makes sense in your case. That is just my general view on returning business classes from a WCF interface.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I had a WCF service that I have coded up, like Clemens Vasters's
I have WCF service with IParameterInspector class which suppose to store the message for
How to update WCF service reference dynamically in silverlight ? Suppose I have created
Lets suppose I have an .NET client application that connects to a WCF service,
Suppose i have following WCF Services. UtilityService (Service to provide utility functions) SomeOtherService 1
If I need to go from this service contract: [ServiceContract(Namespace=http://api.x.com/Svc1)] public interface IService1 {
Suppose I have a WCF service that is not session or singleton based and
Suppose I have a method which changes the state of an object, and fires
Suppose I want to create a (stateless) WCF service with three methods exposed on
Suppose I wanted to create a WCF WebHTTP service (ServiceREST) that had a reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.