diff --git a/LiteCharms.Features.MidrandBooks.Seed/LiteCharms.Features.MidrandBooks.Seed.csproj b/LiteCharms.Features.MidrandBooks.Seed/LiteCharms.Features.MidrandBooks.Seed.csproj index 9318292..00927de 100644 --- a/LiteCharms.Features.MidrandBooks.Seed/LiteCharms.Features.MidrandBooks.Seed.csproj +++ b/LiteCharms.Features.MidrandBooks.Seed/LiteCharms.Features.MidrandBooks.Seed.csproj @@ -11,7 +11,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/LiteCharms.Features.MidrandBooks.Tests/LiteCharms.Features.MidrandBooks.Tests.csproj b/LiteCharms.Features.MidrandBooks.Tests/LiteCharms.Features.MidrandBooks.Tests.csproj index b8084c2..43713e6 100644 --- a/LiteCharms.Features.MidrandBooks.Tests/LiteCharms.Features.MidrandBooks.Tests.csproj +++ b/LiteCharms.Features.MidrandBooks.Tests/LiteCharms.Features.MidrandBooks.Tests.csproj @@ -12,11 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/LiteCharms.Features.MidrandBooks/LiteCharms.Features.MidrandBooks.csproj b/LiteCharms.Features.MidrandBooks/LiteCharms.Features.MidrandBooks.csproj index 022093b..d081be5 100644 --- a/LiteCharms.Features.MidrandBooks/LiteCharms.Features.MidrandBooks.csproj +++ b/LiteCharms.Features.MidrandBooks/LiteCharms.Features.MidrandBooks.csproj @@ -32,7 +32,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/LiteCharms.Features.MidrandBooks/Payments/Entities/PaymentGateway.cs b/LiteCharms.Features.MidrandBooks/Payments/Entities/PaymentGateway.cs index cf47bf9..2853c24 100644 --- a/LiteCharms.Features.MidrandBooks/Payments/Entities/PaymentGateway.cs +++ b/LiteCharms.Features.MidrandBooks/Payments/Entities/PaymentGateway.cs @@ -1,4 +1,4 @@ namespace LiteCharms.Features.MidrandBooks.Payments.Entities; [EntityTypeConfiguration] -public class PaymentGateway : Models.PaymentGateway; +public sealed class PaymentGateway : Models.PaymentGateway; diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260529070104_Init.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260529070104_Init.cs index d960313..2db1138 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260529070104_Init.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260529070104_Init.cs @@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class Init : Migration + public sealed partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530104851_AddedCategories.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530104851_AddedCategories.cs index 96d30de..5703f20 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530104851_AddedCategories.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530104851_AddedCategories.cs @@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class AddedCategories : Migration + public sealed partial class AddedCategories : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530125323_AddedProductCategories.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530125323_AddedProductCategories.cs index 4f35ac7..31db0be 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530125323_AddedProductCategories.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260530125323_AddedProductCategories.cs @@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class AddedProductCategories : Migration + public sealed partial class AddedProductCategories : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260531094401_AddedPaymentObjects.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260531094401_AddedPaymentObjects.cs index b485cd1..304797b 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260531094401_AddedPaymentObjects.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260531094401_AddedPaymentObjects.cs @@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class AddedPaymentObjects : Migration + public sealed partial class AddedPaymentObjects : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260601071804_RemovedPassphraseFromPaymentGateway.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260601071804_RemovedPassphraseFromPaymentGateway.cs index 9401647..5c11b80 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260601071804_RemovedPassphraseFromPaymentGateway.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260601071804_RemovedPassphraseFromPaymentGateway.cs @@ -5,7 +5,7 @@ namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class RemovedPassphraseFromPaymentGateway : Migration + public sealed partial class RemovedPassphraseFromPaymentGateway : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602202421_AddedPaymentGatewayLedger.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602202421_AddedPaymentGatewayLedger.cs index b4cc909..09d4a36 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602202421_AddedPaymentGatewayLedger.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602202421_AddedPaymentGatewayLedger.cs @@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class AddedPaymentGatewayLedger : Migration + public sealed partial class AddedPaymentGatewayLedger : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602205838_AddedPayfastPaymentIdToPaymentGatewayLedger.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602205838_AddedPayfastPaymentIdToPaymentGatewayLedger.cs index e0853da..e6ad58c 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602205838_AddedPayfastPaymentIdToPaymentGatewayLedger.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260602205838_AddedPayfastPaymentIdToPaymentGatewayLedger.cs @@ -5,7 +5,7 @@ namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class AddedPayfastPaymentIdToPaymentGatewayLedger : Migration + public sealed partial class AddedPayfastPaymentIdToPaymentGatewayLedger : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260612210020_OnlyEmailIsMandatoryOnCustomer.cs b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260612210020_OnlyEmailIsMandatoryOnCustomer.cs index a49fdcf..7700dc9 100644 --- a/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260612210020_OnlyEmailIsMandatoryOnCustomer.cs +++ b/LiteCharms.Features.MidrandBooks/Postgres/Migrations/20260612210020_OnlyEmailIsMandatoryOnCustomer.cs @@ -5,7 +5,7 @@ namespace LiteCharms.Features.MidrandBooks.Postgres.Migrations { /// - public partial class OnlyEmailIsMandatoryOnCustomer : Migration + public sealed partial class OnlyEmailIsMandatoryOnCustomer : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/LiteCharms.Features.Tests.Common/LiteCharms.Features.Tests.Common.csproj b/LiteCharms.Features.Tests.Common/LiteCharms.Features.Tests.Common.csproj index 44d6d70..09a2bf4 100644 --- a/LiteCharms.Features.Tests.Common/LiteCharms.Features.Tests.Common.csproj +++ b/LiteCharms.Features.Tests.Common/LiteCharms.Features.Tests.Common.csproj @@ -25,7 +25,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/LiteCharms.Features.Tests/LiteCharms.Features.Tests.csproj b/LiteCharms.Features.Tests/LiteCharms.Features.Tests.csproj index 239381b..718a8f2 100644 --- a/LiteCharms.Features.Tests/LiteCharms.Features.Tests.csproj +++ b/LiteCharms.Features.Tests/LiteCharms.Features.Tests.csproj @@ -12,11 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/LiteCharms.Features/CancellationTokenProvider.cs b/LiteCharms.Features/CancellationTokenProvider.cs new file mode 100644 index 0000000..14c86c8 --- /dev/null +++ b/LiteCharms.Features/CancellationTokenProvider.cs @@ -0,0 +1,16 @@ +namespace LiteCharms.Features; + +public sealed class CancellationTokenProvider : IDisposable +{ + private readonly CancellationTokenSource source = new(); + + public CancellationToken Token => source.Token; + + public void Dispose() + { + source.Cancel(); + source.Dispose(); + + GC.SuppressFinalize(this); + } +} diff --git a/LiteCharms.Features/Extensions/Api.cs b/LiteCharms.Features/Extensions/Api.cs index 33851ad..eb69775 100644 --- a/LiteCharms.Features/Extensions/Api.cs +++ b/LiteCharms.Features/Extensions/Api.cs @@ -241,7 +241,7 @@ public static class Api if (!string.IsNullOrWhiteSpace(urls)) { - string firstUrl = urls.Split(';').FirstOrDefault(s => s.Contains("http://"))! + string firstUrl = urls.Split(';').FirstOrDefault(s => s.Contains("http://", StringComparison.InvariantCultureIgnoreCase))! .Replace("0.0.0.0", "localhost") .Replace("*", "localhost") .Replace("+", "localhost"); diff --git a/LiteCharms.Features/Extensions/S3.cs b/LiteCharms.Features/Extensions/S3.cs index 2b2fd1e..a8b200a 100644 --- a/LiteCharms.Features/Extensions/S3.cs +++ b/LiteCharms.Features/Extensions/S3.cs @@ -19,7 +19,7 @@ public static class S3 AuthenticationRegion = configuration.GetSection($"{BookshopS3SettingsSection}:Region").Value, ForcePathStyle = true, EndpointDiscoveryEnabled = true, - UseHttp = configuration.GetSection($"{BookshopS3SettingsSection}:ServiceUrl").Value!.Contains("http://") + UseHttp = configuration.GetSection($"{BookshopS3SettingsSection}:ServiceUrl").Value!.Contains("http://", StringComparison.InvariantCultureIgnoreCase), })); services.AddKeyedScoped(BookshopBucketName); @@ -36,7 +36,7 @@ public static class S3 AuthenticationRegion = configuration.GetSection($"{BookshopInvoicesS3SettingsSection}:Region").Value, ForcePathStyle = true, EndpointDiscoveryEnabled = true, - UseHttp = configuration.GetSection($"{BookshopS3SettingsSection}:ServiceUrl").Value!.Contains("http://") + UseHttp = configuration.GetSection($"{BookshopS3SettingsSection}:ServiceUrl").Value!.Contains("http://", StringComparison.InvariantCultureIgnoreCase), })); services.AddKeyedScoped(BookshopInvoicesBucketName); @@ -53,7 +53,7 @@ public static class S3 AuthenticationRegion = configuration.GetSection($"{BookshopQuotesS3SettingsSection}:Region").Value, ForcePathStyle = true, EndpointDiscoveryEnabled = true, - UseHttp = configuration.GetSection($"{BookshopS3SettingsSection}:ServiceUrl").Value!.Contains("http://") + UseHttp = configuration.GetSection($"{BookshopS3SettingsSection}:ServiceUrl").Value!.Contains("http://", StringComparison.InvariantCultureIgnoreCase), })); services.AddKeyedScoped(BookshopQuotesBucketName); diff --git a/LiteCharms.Features/Extensions/TaskCancellation.cs b/LiteCharms.Features/Extensions/TaskCancellation.cs new file mode 100644 index 0000000..5681aa6 --- /dev/null +++ b/LiteCharms.Features/Extensions/TaskCancellation.cs @@ -0,0 +1,13 @@ +namespace LiteCharms.Features.Extensions; + +public static class TaskCancellation +{ + public static IServiceCollection AddCancellationToken(this IServiceCollection services) + { + services.AddScoped(); + services.AddScoped(typeof(CancellationToken), + provider => provider.GetRequiredService().Token); + + return services; + } +} diff --git a/LiteCharms.Features/LiteCharms.Features.csproj b/LiteCharms.Features/LiteCharms.Features.csproj index 3012a68..2671c0d 100644 --- a/LiteCharms.Features/LiteCharms.Features.csproj +++ b/LiteCharms.Features/LiteCharms.Features.csproj @@ -79,7 +79,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/LiteCharms.Features/Postgres/DataProtectionDbContext.cs b/LiteCharms.Features/Postgres/DataProtectionDbContext.cs index 3c44486..807b8e9 100644 --- a/LiteCharms.Features/Postgres/DataProtectionDbContext.cs +++ b/LiteCharms.Features/Postgres/DataProtectionDbContext.cs @@ -1,6 +1,6 @@ namespace LiteCharms.Features.Postgres; -public class DataProtectionDbContext(DbContextOptions options) : DbContext(options), IDataProtectionKeyContext +public sealed class DataProtectionDbContext(DbContextOptions options) : DbContext(options), IDataProtectionKeyContext { public DbSet DataProtectionKeys { get; set; } diff --git a/LiteCharms.Features/Postgres/DataProtectionDbContextFactory.cs b/LiteCharms.Features/Postgres/DataProtectionDbContextFactory.cs index f76c93f..dc0d0a0 100644 --- a/LiteCharms.Features/Postgres/DataProtectionDbContextFactory.cs +++ b/LiteCharms.Features/Postgres/DataProtectionDbContextFactory.cs @@ -2,7 +2,7 @@ namespace LiteCharms.Features.Postgres; -public class DataProtectionDbContextFactory : IDesignTimeDbContextFactory +public sealed class DataProtectionDbContextFactory : IDesignTimeDbContextFactory { public DataProtectionDbContext CreateDbContext(string[] args) { diff --git a/LiteCharms.Features/Postgres/Migrations/20260614075149_Init.cs b/LiteCharms.Features/Postgres/Migrations/20260614075149_Init.cs index 7b3d87c..41985a9 100644 --- a/LiteCharms.Features/Postgres/Migrations/20260614075149_Init.cs +++ b/LiteCharms.Features/Postgres/Migrations/20260614075149_Init.cs @@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Features.Postgres.Migrations { /// - public partial class Init : Migration + public sealed partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder)