In [ this post ], I am struggling to implement a state template, as @jonp suggests. I donโt quite understand how to use what he wrote, but it leads to the thought that maybe I'm trying to insert a square anchor into a round hole. So my question is:
If I have a visitor to my site that can play several roles, i.e. Usercan be Vendor, Employer, a Advertiser, or all of the above, whether to use inheritance? I stated:
class Vendor : User {}
class Advertiser : User {}
et cetera, but when the user is both a seller and an employer, then instances of different classes really point to the same base object ... I'm not sure if this might work. How to do it?
* update *
Thanks to everyone (all of you get a point (all that I can give)). I pulled my hair out of deep copies using EF, downcasting and state design over the past few days. The role-based approach makes much more sense.
source
share