dimanche 3 mars 2019

Best way to design a base type with hundreds of child types with different properties values

I have this scenario:

There is one base type say its a document. Then there are almost 100 types of documents with varying properties.

for example:

BaseDoc:
    PropA = null
    PropB =defXyz
    PropC = defCCC

Doc A: BaseDoc
    PropA = true
    PropB =Xyz
    PropC = CCC

Doc B:BaseDoc
    PropA = false
    PropB =Xyz1
    PropC = CCC1

Right now this is what I was doing for each document, create new class and then add its properties. But now I have 100s of documents and it looks very bad to create 100 classes for each document.

What is the best way to achieve this type of result.

I am using c# if it matters.

Aucun commentaire:

Enregistrer un commentaire