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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:03:24+00:00 2026-06-09T13:03:24+00:00

Problem: Class B is a subclass of Class A. RIA service returns a list

  • 0

Problem: Class B is a subclass of Class A. RIA service returns a list of object Bs. Class A and B are both necessarily defined on the server-side. They serialize fine, and I can use them in the primary client project.

I have two other libraries, organized as client libraries. One is for custom controls, and the other is for classes that are shared between custom controls and the actual client project.

I need Class A to be accessible from the Classes library clientside (so that the custom controls can get to it). How can I do this?

I’ve done this:

http://msdn.microsoft.com/en-us/library/ee707369%28v=vs.91%29.aspx

but the *.shared.cs convention doesn’t give libraries other than the actual Client library access to Class A. The second method (Add as Link) does do what I want it to do, except that updating ClassA.cs in the server project doesn’t cause the Client version to update, making it necessary to update both class files each time they’re changed, which is unacceptable.

edit: Add as Link worked great after trying again several times.

  • 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-09T13:03:25+00:00Added an answer on June 9, 2026 at 1:03 pm

    In Visual Studio (2010, at least — dunno exactly whe the feature was added), you can add an existing item to a project as a ‘link’, meaning the source file is shared between projects. Only one version of the source file exists.

    1. Right-click on your project.
    2. Click on ‘Add..Existing Item’.
    3. Find the source file of choice and select it.
    4. The ‘Add’ Button is a drop-down. Click the drop-down icon in the button.
    5. Click on ‘Add As Link’.

    Easy!

    Now any change to the share source file is reflected on both places. The drawback, of course, is that the developer gets no indication that changes to the shared source file might have wider ramifications than she might realize.

    Another option would be to create a hard link so two file names reference the same file (‘inode’ in Unix terms). On the command line, just chant the magic incantation:

    fsutil hardlink create <new-filename> <existing-filename>
    

    something like:

    fsutil hardlink create c:\foo\bar\some-project\bazbat.cs c:\foo\bar\another-project\bazbat.cs
    

    The restriction is that both names have to be on the same volume.

    This has the possibility, of course, confusing your source control system. I’m willing to bet that TFS hasn’t consider the possibility that a filesystem isn’t necessarily a tree structure and that the same file might exist in multiple directories.

    Hard-linked files may be deleted in any order: the file ceases to exist when the last link to gets removed.

    The 3rd option, of course, and likely the “best-practice” — hate that term! — is to factor out the shard classes into an independent assembly that gets deployed to both the client and server. If want to limit the number of assemblies floating around, post-build, you can use ilmerge to merge assemblies:

    • http://www.codeproject.com/Articles/9364/Merging-NET-assemblies-using-ILMerge
    • Merge two assemblies at runtime – C#
    • How to merge multiple assemblies into one?

    Come to think of it, there’s also no reason you can’t embed the shared assemblies as embedded resources that get loaded on demand (or even at startup). This might even be cleaner than using ilmerge. Here’s how to do that:

    http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx

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

Sidebar

Related Questions

I am having a problem I am working on a class which is subclass
I have a problem with ViewHolder class. I use ViewHolder to improve my List
I have a strange problem while working with CCSprite subclass Creature. Lets,my object is
Problem: I have a generic super class with type T at GWT client side
Does a subclass inherit, the main class' friend associations (both the main class' own
I got a problem class a { public $aa=1; public function dd(){ $this->aa =
In my class design I ran into the following problem: class MyData { int
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
For context - read this . Problem: class Program { static void Main() {
Good day, I have the following problem: class B extends class A and methods

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.