Question

2
Replies
576
Views
IsraelU1 Member since 2018 7 posts
Sos International Ltd
Posted: 1 year ago
Last activity: 1 year 6 months ago
Closed

Polymorphism data classes

Hi all,

As per requirement we need to create a data class for a Provider entity. There are different kind of Providers such as AUTO, Doctors, Lawyers, etc ... most of them share the same properties but there are some properties specific to the type of Provider and there will be different functionally based on the type of provider, also UI interfaces will be different at some pint of developement.

Therefore i think Polymorphism suits pretty well to this scenario.

I am thinking about creating the following data classes:

Company-Data-Provider -> Concrete class as i want to store all kind of providers in the same table which it will be defined in its corresponding Database table instance associated to this class.

Specialized classes:

Company-Data-Provider-Autos -> Concrete class

Company-Data-Provider-Lawyers -> Concrete class

Company-Data-Provider-Doctors -> Concrete class

I do not know whether this should be the correct configuration/implementation as i have read somewhere in PDN that in order to create Polymorphism in PRPC, the base or parent class (Company-Data-Provider) should be abstract instead of concrete but if i define it abstract i could not associate it to a table and store all provider instances in the same table unless i follow the following setup:

Company-Data-Provider -> abstract class in order to set up Polymorphism

Specialized classes:

Company-Data-Provider-Autos -> Concrete class associated or pointed to table pr_providers

Company-Data-Provider-Lawyers -> Concrete class associated or pointed to table pr_providers

Company-Data-Provider-Doctors -> Concrete class associated or pointed to table pr_providers

My point is how can i set up polymorphism for the above classes and stores all kind of provider instances in the same dedicated table?

I hope i made myself clear on this.

Kind Regards,

Israel

Data Integration
Moderation Team has archived post
Share this page LinkedIn