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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:53:53+00:00 2026-06-16T16:53:53+00:00

We have a somewhat complex hierarchy of classes in our entity model. We have

  • 0

We have a somewhat complex hierarchy of classes in our entity model. We have a base class BaseEntity for all entities, then some “level 2” classes derived from BaseEntity, some “level 3” classes derived from any “level 2” class, and a lot of “level 4” classes, derived from any “level 3” class. That means, we have something like this:

  • BaseEntity
    • DerivedEntity_1
      • DerivedEntity_1_1
        • DerivedEntity_1_1_1
        • DerivedEntity_1_1_2
        • DerivedEntity_1_1_3
      • DerivedEntity_1_2
        • DerivedEntity_1_2_1
        • DerivedEntity_1_2_2
    • DerivedEntity_2
      • DerivedEntity_2_1
        • DerivedEntity_2_1_1
      • DerivedEntity_2_2
        • DerivedEntity_2_2_1
        • DerivedEntity_2_2_2
        • DerivedEntity_2_2_3
        • DerivedEntity_2_2_4

And so on and so forth…

Now, when transferring instances of these types via WCF using protobuf-net, only the properties of the “level 4” classes are transferred – all properties from the base classes are lost!

From several other StackOverflow threads (here, here, and here), I read that this is the default behavior and that you have two options to work around it:

  1. Use the [ProtoInclude] attribute on the base class.
  2. Configure the inheritance at runtime using a TypeModel and AddSubType().

However, none of these options are feasible in our scenario since we have a lot of derived classes. Option 1 would mean hundreds of attributes on the level 1 base class. Option 2 would mean a lot of calls to AddSubType().

Are there any other options?

  • 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-16T16:53:54+00:00Added an answer on June 16, 2026 at 4:53 pm

    Ultimately, it needs to understand how it should store the data, so that you can get it back. It can’t just guess… So: the only robust way to do that is to define the model somewhere. That doesn’t have to be in raw code, though: for example, maybe it could be stored in an external file that you include and process (via AddSubType) at runtime.

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

Sidebar

Related Questions

I have a PHP web app that generates a somewhat complex report from our
I have a somewhat complex pricing mechanism in my application- Here are some of
I have a somewhat complex iOS view hierarchy. One piece of text is an
I have a somewhat complex data model in my iPad application (an OpenGL drawing
I have following somewhat complex sql query which has horrible performance, 'certainly' due to
This is somewhat complex (well to me at least). Here is what I have
I am writing a somewhat complex game engine in Android. Currently I have a
I have several UIViews that have somewhat complex shapes that I have drawn via
I have a somewhat complex custom user control, created in C# .NET, which is
I have an ObservableCollection of ChildViewModels with somewhat complex behaviour. When I go to

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.