Posted: 8 Feb 2019 2:58 EST Last activity: 25 Feb 2019 5:23 EST
Polymorphism data classes
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.
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
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?