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

Implement discriminator for models #3500

Open
ArcturusZhang opened this issue Jun 3, 2024 · 0 comments · May be fixed by #3599
Open

Implement discriminator for models #3500

ArcturusZhang opened this issue Jun 3, 2024 · 0 comments · May be fixed by #3599
Assignees

Comments

@ArcturusZhang
Copy link
Member

The discriminator should follow the following designs:

  1. the base model should be abstract.
  2. the discriminator property is internal by default. There is an option that could make it public.
  3. the ctor of base model is protected. The discriminator property is passed in in this ctor.
  4. the derived models inherit from the base model, and assign value to the discriminator property in its initialization ctor.
  5. the serialization ctor takes the discriminator as a parameter
  6. an extra internal class (maybe sealed) is created which inherits from the base model with the name of Unknown{BaseModelName} to represent the case that we get an unknown value of the discriminator from the service.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant