I've been developing some projects over .NET and right now I'm working to find a way to reduce the amount of code needed each time I start a new project.
By now, I've created a nuget package to handle the authentication. Every time I start a new project, I only need to import that package, call the load_config function and I got authentication working.
Now i'm attempting to find a way to create extensions to this package. For example, what I would enjoy to have is to have a bunch of other private nuget packages that, when added to the project, would add more methods/fields to the classes of that package.
For example:
- Package Authentication - I have the class BaseUser with the required fields to authenticate (Id, Name, password, tokens, etc)
- Package Authentication.SocialProviders - I have the required fields and methods to integrate social login (facebook, google, so on)
- Package Addresses - Extend the BaseUser class, adding two fields to the BaseUser class (BillingAddress, ShippingAddress) and respective methods to manage those data
- Package Messages - Extend the BaseUser class, adding more fields and methods to the BaseUserClass
Regarding this example, in some projects I want my final User class to extend Authentication + SocialProviders + Addresses, while in others I would want to have them all.
Due to this last phrase, the packages cannot extends each other directly. Is there any way to implement what I'm looking for?
Thanks