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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:38:08+00:00 2026-05-29T21:38:08+00:00

I am trying to construct a serialisation system for our application that must be

  • 0

I am trying to construct a serialisation system for our application that must be able to handle inheritance. To further complicate matters the application is extensible so types might are very unlikely to be known at compile time.

I have read through a previous stackoverflow question that was answered and that helped me get a long way to my goal but I have hit a stumbling block that is probably more of a lack of understanding than any real issue!

So this is the code that I have currently…

public interface IBaseFrame
{

}

public class BasicDataFrame : IBaseFrame
{

}

public class AnotherFrame : BasicDataFrame
{

}

.
.
.
.

RuntimeTypeModel model = TypeModel.Create();
MetaType baseType = model.Add(typeof(IBaseFrame), true);
MetaType basicFrameType = model.Add(typeof(BasicDataFrame),true);

baseType.AddSubType(7, typeof(BasicDataFrame));
model.Add(typeof(AnotherFrame), true);

basicFrameType.AddSubType(8, typeof(AnotherFrame));

Now this code works correctly (as far as I can tell!) and all is good in the world… My concern is where the values 7 and 8 are used in the code above for the fieldNumber argument of the AddSubType method.

As the plugins are enumerated I am registering their frame types with the SerialisationManager and I add them to the model with an incrementing counter for the fieldNumber (I start it at an arbitrarily large number so I don’t have to worry about extending the base classes in the future).

I am worried that if the plugins are enumerated in a different order or new ones are added (or removed) then the auto generated fieldNumber is going to be different for the different sub types that will then cause issues with sharing log files between users (who may have different plugins and therefore subtypes) or even files on the same system when a plugin may have been removed.

Is there any cunning way of dealing with this kind of inheritance automatically and without introducing compatibility issues in the future or when plugins change or do I need to come up with a mechanism where these fieldNumbers can be guaranteed to remain contant across all installations?

Any help or advice that can be given would be greatly appreciated!

  • 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-29T21:38:12+00:00Added an answer on May 29, 2026 at 9:38 pm

    No magic here; the numbers are essentially part of the contract, and it is important that they can be reliably reproduced if you want to deserialize data you stored previously. If the data can’t be known at compile-time, maybe configuration or some external registry of types to field numbers may help. Your concerns are accurate.

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

Sidebar

Related Questions

I'm trying to construct a query that will include a column indicating whether or
I am trying to construct a Groovy statement to find values that don't exist
I'm trying construct a PostgreSQL query that does the following but so far my
I am trying to construct a method that will allow me to find the
Trying to construct a helper class that will return an arraylist, but I'm getting
I'm trying to construct a JDOQL query (using datanucleus) that will search for matches
I am trying to Construct a URI. But I am unable to handle bad
I'm trying to construct a linq query that pulls all nodes that have a
Trying to construct a query such that I have multiple statement specifying joins, each
I'm trying to construct a MySQL query that will only return unassigned tasks. A

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.