From 02c98de33722799918daf57b4d9bc0eb2b13d612 Mon Sep 17 00:00:00 2001 From: skwasjer Date: Sun, 14 Nov 2021 01:33:19 +0100 Subject: [PATCH] docs: add package README's (#59) --- README.md | 7 +++- .../IbanNet.DataAnnotations.csproj | 5 +++ src/IbanNet.DataAnnotations/README.md | 35 ++++++++++++++++ ...IbanNet.DependencyInjection.Autofac.csproj | 5 +++ .../README.md | 37 +++++++++++++++++ ...DependencyInjection.ServiceProvider.csproj | 5 +++ .../README.md | 37 +++++++++++++++++ .../IbanNet.FluentValidation.csproj | 5 +++ src/IbanNet.FluentValidation/README.md | 41 +++++++++++++++++++ src/IbanNet/IbanNet.csproj | 5 +++ src/IbanNet/README.md | 39 ++++++++++++++++++ 11 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 src/IbanNet.DataAnnotations/README.md create mode 100644 src/IbanNet.DependencyInjection.Autofac/README.md create mode 100644 src/IbanNet.DependencyInjection.ServiceProvider/README.md create mode 100644 src/IbanNet.FluentValidation/README.md create mode 100644 src/IbanNet/README.md diff --git a/README.md b/README.md index 0ff235f7..e67bd16c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # IbanNet -IbanNet is a .NET library providing functionality to validate and parse an [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) also known as IBAN. +IbanNet is a .NET library providing functionality to validate and parse an [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) also known as IBAN. + +Additionally, IbanNet provides: +- the `Iban` primitive type, which can be used as a drop in replacement for a `string` in your domain. +- a builder to construct IBAN's from a Basic Bank Account Number (BBAN). +- a generator to assist with (unit) testing. --- diff --git a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj index f49c8888..95b159f4 100644 --- a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj +++ b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj @@ -9,8 +9,13 @@ Data annotations to validate IBAN user input. https://github.com/skwasjer/IbanNet/wiki/IbanNet.DataAnnotations IBAN, International Bank Account Number, Web API, MVC + README.md + + + + diff --git a/src/IbanNet.DataAnnotations/README.md b/src/IbanNet.DataAnnotations/README.md new file mode 100644 index 00000000..1a2d708f --- /dev/null +++ b/src/IbanNet.DataAnnotations/README.md @@ -0,0 +1,35 @@ +`IbanNet.DataAnnotations` provides an attribute allowing validation of IBAN user input with ASP.NET (Core) and Microsoft Data Annotations. + +## Example + +```csharp +public class InputModel +{ + [Iban] + [Required] + public string BackAccountNumber { get; set; } +} + +[ApiController] +public class MyController : ControllerBase +{ + [HttpPost] + public ActionResult Save(InputModel model) + { + if (ModelState.IsValid) + { + // .. + } + } +} +``` + +## Other info + +- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) +- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) +- [Fiddle](https://dotnetfiddle.net/JeGa9x) + +### Contributions + +Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). diff --git a/src/IbanNet.DependencyInjection.Autofac/IbanNet.DependencyInjection.Autofac.csproj b/src/IbanNet.DependencyInjection.Autofac/IbanNet.DependencyInjection.Autofac.csproj index 6cb11689..3b252293 100644 --- a/src/IbanNet.DependencyInjection.Autofac/IbanNet.DependencyInjection.Autofac.csproj +++ b/src/IbanNet.DependencyInjection.Autofac/IbanNet.DependencyInjection.Autofac.csproj @@ -9,8 +9,13 @@ Autofac IoC container integration for IbanNet; IbanNet provides an IBAN validator and parser. https://github.com/skwasjer/IbanNet/wiki/Dependency-injection IBAN, IoC, Autofac, IbanNet, dependencyinjection + README.md + + + + diff --git a/src/IbanNet.DependencyInjection.Autofac/README.md b/src/IbanNet.DependencyInjection.Autofac/README.md new file mode 100644 index 00000000..bc5f5aca --- /dev/null +++ b/src/IbanNet.DependencyInjection.Autofac/README.md @@ -0,0 +1,37 @@ +Autofac IoC container integration for IbanNet; [IbanNet](https://github.com/skwasjer/IbanNet) provides an IBAN validator and parser. + +## Available services + +This library registers the following services: + +- `IIbanValidator` +- `IIbanGenerator` +- `IIbanParser` + +## Example + +Register IbanNet services: + +```csharp +container.RegisterIbanNet(); +``` + +Or register IbanNet services with configuration: + +```csharp +container + .RegisterIbanNet(opts => opts + .UseRegistryProvider(new SwiftRegistryProvider()) + .WithRule() + ); +``` + +## Other info + +- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) +- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) +- [Fiddle](https://dotnetfiddle.net/JeGa9x) + +### Contributions + +Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). diff --git a/src/IbanNet.DependencyInjection.ServiceProvider/IbanNet.DependencyInjection.ServiceProvider.csproj b/src/IbanNet.DependencyInjection.ServiceProvider/IbanNet.DependencyInjection.ServiceProvider.csproj index c7569aa1..d9b70dc9 100644 --- a/src/IbanNet.DependencyInjection.ServiceProvider/IbanNet.DependencyInjection.ServiceProvider.csproj +++ b/src/IbanNet.DependencyInjection.ServiceProvider/IbanNet.DependencyInjection.ServiceProvider.csproj @@ -9,8 +9,13 @@ Microsoft.Extensions.DependencyInjection integration for IbanNet; IbanNet provides an IBAN validator and parser. https://github.com/skwasjer/IbanNet/wiki/Dependency-injection IBAN, IbanNet, IoC, dependencyinjection, di, servicecollection, serviceprovider + README.md + + + + diff --git a/src/IbanNet.DependencyInjection.ServiceProvider/README.md b/src/IbanNet.DependencyInjection.ServiceProvider/README.md new file mode 100644 index 00000000..69cca737 --- /dev/null +++ b/src/IbanNet.DependencyInjection.ServiceProvider/README.md @@ -0,0 +1,37 @@ +`Microsoft.Extensions.DependencyInjection` integration for IbanNet; [IbanNet](https://github.com/skwasjer/IbanNet) provides an IBAN validator and parser. + +## Available services + +This library registers the following services: + +- `IIbanValidator` +- `IIbanGenerator` +- `IIbanParser` + +## Example + +Add IbanNet services: + +```csharp +services.AddIbanNet(); +``` + +Or add IbanNet services with configuration: + +```csharp +services + .AddIbanNet(opts => opts + .UseRegistryProvider(new SwiftRegistryProvider()) + .WithRule() + ); +``` + +## Other info + +- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) +- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) +- [Fiddle](https://dotnetfiddle.net/JeGa9x) + +### Contributions + +Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). diff --git a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj index 7631960e..399f667e 100644 --- a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj +++ b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj @@ -9,8 +9,13 @@ FluentValidation support to validate IBAN user input. https://github.com/skwasjer/IbanNet/wiki/IbanNet.FluentValidation IBAN, International Bank Account Number, FluentValidation, Web API, MVC + README.md + + + + diff --git a/src/IbanNet.FluentValidation/README.md b/src/IbanNet.FluentValidation/README.md new file mode 100644 index 00000000..40f651b7 --- /dev/null +++ b/src/IbanNet.FluentValidation/README.md @@ -0,0 +1,41 @@ +FluentValidation support to validate IBAN user input. + +## Example + +Create a rule for a property and call the `Iban(IIbanValidator)` extension method to enable the validator. + +```csharp +public class InputModel +{ + public string BackAccountNumber { get; set; } +} + +public class InputModelValidator : AbstractValidator +{ + public InputModelValidator(IIbanValidator ibanValidator) + { + RuleFor(x => x.BankAccountNumber).NotNull().Iban(ibanValidator); + } +} +``` + +Prerequisite service registration (.NET Core) of IbanNet. + +```csharp +services.AddIbanNet(); +services.AddTransient, InputModelValidator>() +services.AddFluentValidation(); +``` + +For more information on how to register FluentValidation and custom abstract validators: +https://docs.fluentvalidation.net/en/latest/aspnet.html + +## Other info + +- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) +- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) +- [Fiddle](https://dotnetfiddle.net/JeGa9x) + +### Contributions + +Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). diff --git a/src/IbanNet/IbanNet.csproj b/src/IbanNet/IbanNet.csproj index 931a464a..244dab8d 100644 --- a/src/IbanNet/IbanNet.csproj +++ b/src/IbanNet/IbanNet.csproj @@ -11,7 +11,12 @@ Provides a strict International Bank Account Number (IBAN) validator, parser, builder, generator and the Iban primitive type. https://github.com/skwasjer/IbanNet/wiki IBAN, International Bank Account Number + README.md + + + + diff --git a/src/IbanNet/README.md b/src/IbanNet/README.md new file mode 100644 index 00000000..5fa97ad0 --- /dev/null +++ b/src/IbanNet/README.md @@ -0,0 +1,39 @@ +IbanNet is a .NET library providing functionality to validate and parse an [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) also known as IBAN. + +Additionally, IbanNet provides: +- the `Iban` primitive type, which can be used as a drop in replacement for a `string` in your domain. +- a builder to construct IBAN's from a Basic Bank Account Number (BBAN). +- a generator to assist with (unit) testing. + +## Example with validator + +```csharp +IIbanValidator validator = new IbanValidator(); +ValidationResult validationResult = validator.Validate("NL91 ABNA 0417 1643 00"); +if (validationResult.IsValid) +{ + // .. +} +``` + +## Example with `Iban` type + +```csharp +Iban iban; +IIbanParser parser = new IbanParser(IbanRegistry.Default); +bool success = parser.TryParse("NL91 ABNA 0417 1643 00", out iban); +if (success) +{ + Console.WriteLine(iban.ToString(IbanFormat.Obfuscated)); // XXXXXXXXXXXXXX4300 +} +``` + +## Other info + +- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) +- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) +- [Fiddle](https://dotnetfiddle.net/JeGa9x) + +### Contributions + +Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md).