diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-01-30 01:41:08 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-01-30 01:41:08 +0100 |
| commit | 36afcdf0988e753ae2178fb8220b02f2c4d0b2b2 (patch) | |
| tree | d27cb629cd53eeef6737ddc86915d51a9ac4b9c3 /src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs | |
| parent | bbe0fb036a790b6a23a478d3f047add63b3b07a6 (diff) | |
| download | dotnet-vipps-ecommerce-36afcdf0988e753ae2178fb8220b02f2c4d0b2b2.tar.xz dotnet-vipps-ecommerce-36afcdf0988e753ae2178fb8220b02f2c4d0b2b2.zip | |
refactor: Convert solution for file-scoped namespaces
Diffstat (limited to 'src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs')
| -rw-r--r-- | src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs b/src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs index e6a4fcd..41af6a5 100644 --- a/src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs +++ b/src/IOL.VippsEcommerce/ServiceCollectionExtensions.cs @@ -2,32 +2,31 @@ using System; using IOL.VippsEcommerce.Models; using Microsoft.Extensions.DependencyInjection; -namespace IOL.VippsEcommerce -{ - public static class ServiceCollectionExtensions - { - /// <summary> - /// Configures and adds the VippsEcommerceService to your DI. - /// </summary> - /// <param name="services">Servicecollection to add VippsEcommerceService to.</param> - /// <param name="configuration"></param> - /// <returns></returns> - public static IServiceCollection AddVippsEcommerceService( - this IServiceCollection services, - Action<VippsConfiguration> configuration - ) { - if (services == null) { - throw new ArgumentNullException(nameof(services)); - } +namespace IOL.VippsEcommerce; - if (configuration == null) { - throw new ArgumentNullException(nameof(configuration)); - } +public static class ServiceCollectionExtensions +{ + /// <summary> + /// Configures and adds the VippsEcommerceService to your DI. + /// </summary> + /// <param name="services">Servicecollection to add VippsEcommerceService to.</param> + /// <param name="configuration"></param> + /// <returns></returns> + public static IServiceCollection AddVippsEcommerceService( + this IServiceCollection services, + Action<VippsConfiguration> configuration + ) { + if (services == null) { + throw new ArgumentNullException(nameof(services)); + } - services.Configure(configuration); - services.AddHttpClient<IVippsEcommerceService, VippsEcommerceService>(); - services.AddScoped<IVippsEcommerceService, VippsEcommerceService>(); - return services; + if (configuration == null) { + throw new ArgumentNullException(nameof(configuration)); } + + services.Configure(configuration); + services.AddHttpClient<IVippsEcommerceService, VippsEcommerceService>(); + services.AddScoped<IVippsEcommerceService, VippsEcommerceService>(); + return services; } } |
