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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:01:26+00:00 2026-06-15T21:01:26+00:00

I have a Silverlight app I’ve been working on. This app relies on a

  • 0

I have a Silverlight app I’ve been working on. This app relies on a custom class called Customer. Instances of this class are returned from my web service. I’ve need to add a method called CalculateLoyalty() to this class definition. I want CalculateLoyalty to be available on both the server and client-side (my Silverlight app).

Currently, I can use CalculateLoyalty just fine on the server. Unfortunately, the method doesn’t seem to get passed across the wire. I have a hunch its some serialization thing. How do I add a method to my class definition on the server-side and ensure that it is available on the client-side?

Thank you!

  • 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-06-15T21:01:28+00:00Added an answer on June 15, 2026 at 9:01 pm

    When you generate a service reference, it only copies public properties and fields. You can share classes between your server and client and avoid using a service reference. I’m not going to go into detail with how to do this, but here are some related questions that explain what needs to be done.

    Create WCF Client without auto generated proxy
    Call synchronous WCF operation contract methods asynchronously on silverlight

    Even if you do this, I have to recommend against putting logic on your DTOs. I’d recommend creating a LoyaltyCalculator class and passing a Customer to this. In fact, you can do this even if you use generate your client through the Add Service Reference option.

    Your defult Silverlight solution will have 2 projects.

    • MyApp – This is your Silverlight project.
    • MyApp.Web – This is the host web project.

    You don’t need to do this, but I recommend adding 2 new projects.

    • MyApp.Shared – A .NET Class Library
    • MyApp.Shared.Silverlight – A Silverlight Class Library.

    At this point, you will want to add a project reference to the appropriate class library to both your Silverlight project and your Web project.

    Add class LoyaltyCalculator to MpApp.Shared, or MyApp.Web if you don’t want to make the shared libraries. Go ahead and implement this class here.

    Now in MyApp.Shared.Silverlight, or MyApp if you don’t want to make the shared libraries, select Add -> Existing Item. Browse to and select LoyaltyCalculator.cs. Do Not Double Click It!!! Instead, click the little down / more arrow on the Add button. Now select Add As Link.

    LoyaltyCalculator is now available to both your server and client and you only have to maintain one copy.

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

Sidebar

Related Questions

I have a Silverlight 5 app. This app has been in development for 18
I have a Silverlight app with a DataGrid containing some custom columns and all
I have a WCF web-service and a Silverlight app displaying data from that service.
I have a Silverlight 4 app which pulls entities down from a database using
I have made a Silverlight app that contain a class and I want to
I have created a class that inherits for DomainService and have a Silverlight app
I have a Silverlight 5 app that gets some data from a couple Sharepoint
Overview: I have a Silverlight 4 app where I am seeing problematic behavior from
I have added a ServiceReference to my Silverlight app. I have called it, WcfServiceReference.
I have a Silverlight App which gets its data from a database. My Silverlight

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.