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 974643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:27:56+00:00 2026-05-16T03:27:56+00:00

Let me try to explain my challenge. I’m building a Silverlight app which will

  • 0

Let me try to explain my challenge. I’m building a Silverlight app which will be using a WCF service.

The WCF service returns a list of users and roles (and lots more but trying to keep it simple).

In the SL app I need to fill several comboboxes with lists of users and roles. Usually I would use an interface to specify the key and value pair and could simply bind these to the combobox

But alas WCF doesn’t provide interfaces just dataclasses. What would be a nice solution to get what I want.

I started out with a GetList method but its missing some magic. Or maybe use a ‘generic’ class with key/value and write a OperionContract which returns these…

Do I make any sense and what would you do?

public class Users
{
    public string Name { get; set; }
    public int Id { get; set; }
    //Etc lastname, password
}

public class Roles
{
    public string Name { get; set; }
    public int Id { get; set; }
    //Etc icon, superuser, whatnot
}

public class Pager
{
    public static List<KeyValuePair<string, int>> GetList(List<object> itemlist)
    {
        var result = new List<KeyValuePair<string, int>>();
        //Do some magic

        return result;
    }

EDIT
Using an abstract class helps a bit. Until I need more ‘interfaces’..

  • 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-16T03:27:57+00:00Added an answer on May 16, 2026 at 3:27 am

    When you receive something “over the wire” via WCF, you are getting a concrete implementation. It makes sense that interfaces aren’t provided because those are abstract, and you are getting concrete types.

    However, there are two ways you can preserve the interface over the wire.

    The first, as Bryan Watts indicated, is to implement the interface on your client. I rarely use the proxied items that are passed directly from the WCF service; instead, I typically move them into other objects on the client that can have their own interfaces, base classes, etc. I use the WCF as a data pump and then hydrate the data into concrete classes defined at the client.

    While some people will point out this looks like extra work, I disagree. I rarely build an application “service first.” If I have a widget to deal with, I’ll define the model for my widget, even build tests and can bind to views, etc. The service is just an interface to return widgets so I’m abstracted from the service and can test without it. When the service becomes available, I can simply map what proxy type from the server and move it into my defined widget.

    The second way is to use a technology that projects the data, such as WCF RIA. WCF RIA will use generated code to create a map of the code defined on the server on the client. What this means is the behaviors and annotations are projected via code to the client. Personally I still end up abstracting away and not binding directly to WCF RIA models, so I tend to use the first option most often.

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

Sidebar

Related Questions

WCF service has one method ( Let's say TestMethod) in which I try to
I will try to explain this very simple. So, I skipped any code which
Let me try to explain by example. Say website is hosted at example.com (NOT
Let me try to explain it. Please tell me if I am wrong. I
Ok so let me try to explain this the best way that i can.
I try to implement a browser-like app. I want to let it can open
Let me try to explain the situation the best I can. Lets say I
Let me try and explain the scenario: I have a form with multiple items
Let me try and explain what I want to achieve. I want X boxes
Let me try to explain this the best I can. I have a component

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.