antonyoung / Validators

Engine as validator, formatter of European Postal Codes and or International Bank Accounts Numbers ( IBAN, ) It's fast, it's simple and it works ( based on regular expressions and C#, NET Standard 2.1 ) Easy extendable, deployed as separate nuget-packages.
GNU General Public License v3.0
2 stars 1 forks source link

Feature: Setup default country as configuration or as with DI #95

Open antonyoung opened 1 year ago

antonyoung commented 1 year ago

Is your feature request related to a problem? Please describe. Currently default country is "hard coded" as Netherlands. This should be configurable for each Validator nuget-package.

Describe the solution you'd like Have an appsetting that we can configure what the default country has to be set as. We have to take in account this could be different for each validator nuget-package. So it should distinguish for which nuget-package.

As example: ( something as appSettings.json) ... AntonYoung.Validators.PostalCode: [ { defaultCountry: "Netherlands" }] AntonYoung.Validators.Iban: [ { defaultCountry: "Spain" }] ...

Where value is based on the enum as name of the country. Then preferable inject the selected enum in constructor as DI. If no value given, then we hard-code it to default country.

Describe alternatives you've considered Other option could be that the nuget-packages their appsettings file and we could read from there. If client doesn't provide default. But the we are getting dependend on appsettings file on each nuget-package.