Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do you have some solution like Data Contract Resolver? #299

Open
soroshsabz opened this issue May 23, 2023 · 8 comments
Open

Do you have some solution like Data Contract Resolver? #299

soroshsabz opened this issue May 23, 2023 · 8 comments

Comments

@soroshsabz
Copy link

ITNOA

as you can see in https://learn.microsoft.com/en-us/archive/msdn-magazine/2011/february/msdn-magazine-data-contract-inheritance-known-types-and-the-generic-resolver#data-contract-resolvers

when WCF try to resolve inheritance in data contract, we have to define Data Contract Resolver like below

public abstract class DataContractResolver {
  protected DataContractResolver();
  
  public abstract bool TryResolveType(
    Type type,Type declaredType,
    DataContractResolver knownTypeResolver, 
    out XmlDictionaryString typeName,
    out XmlDictionaryString typeNamespace);
  public abstract Type ResolveName(
    string typeName,string typeNamespace, 
    Type declaredType,
    DataContractResolver knownTypeResolver);
}

How to get same behavior in protobuf-net.Grpc?

@soroshsabz
Copy link
Author

related to #19

@soroshsabz
Copy link
Author

related to #300

@soroshsabz
Copy link
Author

@mgravell Did you have any idea?

thanks

@mgravell
Copy link
Member

Normally in protobuf-net , we never store explicit type information: we just store a numeric tag; the way we build the serializer currently means that you'd really need to register the known tags in advance (via the "include" functionality, usually via [ProtoInclude(...)] at compile time, although it can also be specified at runtime).

What you are describing here sounds more like "any" (a protobuf feature). I haven't had need to implement good "any" support in protobuf-net, but that's something we could do - however, due to how protobuf objects work, this is more about arbitrary message types, not inheritance.

What would help here is: what is the scenario you're trying to solve?

@soroshsabz
Copy link
Author

I exactly want to resolve some problem like #300

many thanks to response

@soroshsabz
Copy link
Author

soroshsabz commented May 23, 2023

@mgravell I think protobuf-net need some practice like WCF to support inheritance in clean way :)

I think this feature must be add to https://github.com/protobuf-net/protobuf-net

@soroshsabz
Copy link
Author

@mgravell Did you can help me to where this feature must be implemented?

thanks

@soroshsabz
Copy link
Author

@mgravell Did you can help me?

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants