How would you design a solution to this problem?
unsure what would be the best approach -
I have a SQL table that stores SMS 3rd party providers.
Each provider support different protocols for its integration - (HTTP/SMPP).
According to the provider supported protocol it requires different parameters to be stored.
the HTTP providers stores -
So my question is, how would you handle this scenario both in the db and in the code?
Option 1 -
In the DB have a single table for
Protocol is an enum of HTTP/SMPP
And the Custom fields are nvarchar fields that are used according the the Protocol value.
I can select all the providers into a generic
Implement an
Have a factory method that receives a list of
Option2 -
Break the Provider table.
Leaving the Provider table only with the shared fields, and create a relationship tables for
And join both tables?
What would you do?
I have a SQL table that stores SMS 3rd party providers.
Each provider support different protocols for its integration - (HTTP/SMPP).
According to the provider supported protocol it requires different parameters to be stored.
the HTTP providers stores -
- URL endpoint
- Api Key
- IpAddress
- Port
- Username
- Password
So my question is, how would you handle this scenario both in the db and in the code?
Option 1 -
In the DB have a single table for
Provider with such schema - Protocol is an enum of HTTP/SMPP
And the Custom fields are nvarchar fields that are used according the the Protocol value.
I can select all the providers into a generic
Provider class.Implement an
IProvider interface and concrete types - ProviderSMPP and ProviderHTTPHave a factory method that receives a list of
Provider and returns a list of IProvider where I initialize each concrete type using a switch-case on the Protocol field mapping the custom fields into its concrete values.Option2 -
Break the Provider table.
Leaving the Provider table only with the shared fields, and create a relationship tables for
ProviderSMPPCredentials and ProviderHTTPCredentialsAnd join both tables?
What would you do?