From d048fa8ee36105a3f0e7dcb13f6396d25b3d9099 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 24 Nov 2023 23:57:15 +0200 Subject: [PATCH] Many changes Fixed readonly access Migrated to release .NET 8 Split Vogen into separate project Added TransparentValueObjects as an alternative - WIP Fixed ServiceProvider Too Many warning, thanks Npgsql --- build/common.props | 2 +- .../BUTR.Site.NexusMods.Client.csproj | 32 ++--- ...e.NexusMods.Server.ValueObjects.TVO.csproj | 20 +++ ...Server.ValueObjects.TVO.csproj.DotSettings | 3 + .../Extensions/OpenApiExtensions.cs | 9 ++ .../Models/ApplicationRole.cs | 21 ++++ .../Models/CrashReportFileId.cs | 16 +++ .../Models/CrashReportId.cs | 18 +++ .../Models/CrashReportUrl.cs | 18 +++ .../Models/CrashReportVersion.cs | 16 +++ .../Models/ExceptionTypeId.cs | 16 +++ .../Models/GameVersion.cs | 16 +++ .../Models/IValueObjectFrom.cs | 9 ++ .../Models/ModuleId.cs | 16 +++ .../Models/ModuleVersion.cs | 16 +++ .../Models/NexusModsApiKey.cs | 19 +++ .../Models/NexusModsArticleId.cs | 41 +++++++ .../Models/NexusModsFileId.cs | 16 +++ .../Models/NexusModsGameDomain.cs | 61 +++++++++ .../Models/NexusModsModId.cs | 43 +++++++ .../Models/NexusModsUserEMail.cs | 18 +++ .../Models/NexusModsUserId.cs | 43 +++++++ .../Models/NexusModsUserName.cs | 18 +++ .../Models/TenantId.cs | 49 ++++++++ .../Usings.cs | 20 +++ .../TransparentValueObjectSchemaFilter.cs | 16 +++ .../TransparentValueObjectTypeConverter.cs | 19 +++ .../Utils/_CopyHelper.cs} | 4 +- .../Utils/_QueryableHelper.cs | 15 +++ ...NexusMods.Server.ValueObjects.Vogen.csproj | 20 +++ ...rver.ValueObjects.Vogen.csproj.DotSettings | 3 + .../Extensions/EfCoreExtensions.cs | 73 +++++++++++ .../Extensions/OpenApiExtensions.cs | 9 ++ .../Models}/ApplicationRole.cs | 22 ++-- .../Models}/CrashReportFileId.cs | 9 -- .../Models}/CrashReportId.cs | 9 -- .../Models}/CrashReportUrl.cs | 9 -- .../Models}/CrashReportVersion.cs | 9 -- .../Models}/ExceptionTypeId.cs | 9 -- .../Models}/GameVersion.cs | 8 -- .../Models}/ModuleId.cs | 9 -- .../Models}/ModuleVersion.cs | 9 -- .../Models}/NexusModsApiKey.cs | 15 +-- .../Models}/NexusModsArticleId.cs | 15 +-- .../Models}/NexusModsFileId.cs | 9 -- .../Models}/NexusModsGameDomain.cs | 26 ++-- .../Models}/NexusModsModId.cs | 15 +-- .../Models}/NexusModsUserEMail.cs | 15 +-- .../Models}/NexusModsUserId.cs | 15 +-- .../Models}/NexusModsUserName.cs | 15 +-- .../Models}/TenantId.cs | 26 ++-- .../Usings.cs | 20 +++ .../Utils}/IHasCopy.cs | 2 +- .../Utils}/IHasDefaultValue.cs | 2 +- .../Utils}/IHasDeserialize.cs | 2 +- .../Utils}/IHasIsInitialized.cs | 2 +- .../Utils}/IHasRandomValueGenerator.cs | 4 +- .../Utils/IVogen.cs | 27 ++++ .../Utils/IVogenParsable.cs | 9 ++ .../Utils/IVogenSpanParsable.cs | 9 ++ .../Utils/IVogenUtf8SpanParsable.cs | 9 ++ .../Utils}/VogenDefaults.cs | 5 +- .../Utils}/VogenDefaultsParsable.cs | 5 +- .../VogenDefaultsRandomValueGenerator.cs | 6 +- .../Utils}/VogenDefaultsSpanParsable.cs | 5 +- .../Utils}/VogenDefaultsUtf8SpanParsable.cs | 5 +- .../Utils}/VogenJsonConverter.cs | 6 +- .../Utils}/VogenSchemaFilter.cs | 8 +- .../Utils}/VogenTypeConverter.cs | 6 +- .../Utils}/VogenValueComparer.cs | 9 +- .../Utils}/VogenValueComparerReference.cs | 9 +- .../Utils}/VogenValueConverter.cs | 8 +- .../Utils/_CopyHelper.cs | 26 ++++ .../Utils/_QueryableHelper.cs | 15 +++ .../BUTR.Site.NexusMods.Server.csproj | 42 +++---- ...R.Site.NexusMods.Server.csproj.DotSettings | 4 + .../Contexts/AppDbContextRead.cs | 36 ++---- .../Contexts/AppDbContextWrite.cs | 23 +--- .../Contexts/BaseAppDbContext.cs | 116 ++++++++---------- .../Configs/BaseEntityConfiguration.cs | 2 +- .../BaseEntityConfigurationWithTenant.cs | 4 +- .../Configs/CrashReportEntityConfiguration.cs | 11 +- ...hReportIgnoredFileIdEntityConfiguration.cs | 4 +- .../CrashReportToFileIdEntityConfiguration.cs | 6 +- ...rashReportToMetadataEntityConfiguration.cs | 4 +- ...portToModuleMetadataEntityConfiguration.cs | 9 +- .../ExceptionTypeEntityConfiguration.cs | 4 +- .../Contexts/Configs/IEntityConfiguration.cs | 3 + ...grationDiscordTokensEntityConfiguration.cs | 3 +- ...tionGOGToOwnedTenantEntityConfiguration.cs | 4 +- ...IntegrationGOGTokensEntityConfiguration.cs | 3 +- ...onSteamToOwnedTenantEntityConfiguration.cs | 4 +- ...tegrationSteamTokensEntityConfiguration.cs | 3 +- .../Configs/ModuleEntityConfiguration.cs | 4 +- .../NexusModsArticleEntityConfiguration.cs | 5 +- .../NexusModsModEntityConfiguration.cs | 4 +- ...sModsModToFileUpdateEntityConfiguration.cs | 3 +- ...NexusModsModToModuleEntityConfiguration.cs | 5 +- ...dToModuleInfoHistoryEntityConfiguration.cs | 9 +- .../NexusModsModToNameEntityConfiguration.cs | 3 +- .../NexusModsUserEntityConfiguration.cs | 4 +- ...odsUserToCrashReportEntityConfiguration.cs | 5 +- ...ToIntegrationDiscordEntityConfiguration.cs | 3 +- ...UserToIntegrationGOGEntityConfiguration.cs | 3 +- ...erToIntegrationSteamEntityConfiguration.cs | 3 +- ...exusModsUserToModuleEntityConfiguration.cs | 5 +- .../NexusModsUserToNameEntityConfiguration.cs | 5 +- ...dsUserToNexusModsModEntityConfiguration.cs | 5 +- .../NexusModsUserToRoleEntityConfiguration.cs | 7 +- ...csCrashScoreInvolvedEntityConfiguration.cs | 7 +- ...icsTopExceptionsTypeEntityConfiguration.cs | 3 +- .../Configs/TenantEntityConfiguration.cs | 4 +- .../Contexts/EntityConfigurationFactory.cs | 14 +-- .../Contexts/NpgsqlDataSourceProvider.cs | 50 ++++++++ .../CrashReportsAnalyzerController.cs | 9 +- .../Controllers/CrashReportsController.cs | 2 - .../Controllers/DiscordController.cs | 2 - .../Controllers/ExposedModsController.cs | 3 - .../Controllers/GOGController.cs | 2 - .../GamePublicApiDiffController.cs | 1 - .../Controllers/GameSourceDiffController.cs | 3 - .../Controllers/NexusModsArticleController.cs | 3 - .../Controllers/NexusModsModController.cs | 2 - .../Controllers/NexusModsUserController.cs | 2 - .../Controllers/QuartzController.cs | 2 - .../Controllers/ReportsController.cs | 1 - .../Controllers/StatisticsController.cs | 3 - .../Controllers/SteamController.cs | 2 - .../DynamicFilterBuilder.cs | 5 +- .../Extensions/IAsyncEnumerableExtensions.cs | 4 +- .../JobExecutionContextExtensions.cs | 1 - .../Extensions/QueryableExtensions.cs | 8 +- .../Extensions/VogenExtensions.cs | 80 ------------ .../Models/API/PagingData.cs | 2 +- .../Options/NexusModsOptions.cs | 2 +- .../Services/CrashReportBatchedHandler.cs | 16 +-- .../HttpClients/NexusModsAPIClient.cs | 2 +- ...lordBinaryCache.cs => SteamBinaryCache.cs} | 4 +- src/BUTR.Site.NexusMods.Server/Startup.cs | 30 ++--- .../Utils/BindingSources/IBindIgnore.cs | 2 +- .../Utils/BlockUntilDateConstraint.cs | 6 +- .../Logging/SyncLoggingHttpMessageHandler.cs | 8 +- .../SyncLoggingScopeHttpMessageHandler.cs | 8 +- .../Npgsql/ImmutableArrayToArrayConverter.cs | 18 --- .../Utils/Vogen/IVogen.cs | 58 --------- .../Clients.cs | 14 +-- .../Utils/OneTimeEnumerable.cs | 2 +- .../Utils/PagingStreamingData.cs | 6 +- .../Utils/StreamWithLfEnding.cs | 6 +- ...R.Site.NexusMods.Shared.csproj.DotSettings | 2 + .../Helpers/NexusModsUtils.cs | 5 +- src/nuget.config | 1 - 152 files changed, 1164 insertions(+), 757 deletions(-) create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/BUTR.Site.NexusMods.Server.ValueObjects.TVO.csproj create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/BUTR.Site.NexusMods.Server.ValueObjects.TVO.csproj.DotSettings create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Extensions/OpenApiExtensions.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/ApplicationRole.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/CrashReportFileId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/CrashReportId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/CrashReportUrl.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/CrashReportVersion.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/ExceptionTypeId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/GameVersion.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/IValueObjectFrom.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/ModuleId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/ModuleVersion.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsApiKey.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsArticleId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsFileId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsGameDomain.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsModId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsUserEMail.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsUserId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/NexusModsUserName.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Models/TenantId.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Usings.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Utils/TransparentValueObjectSchemaFilter.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Utils/TransparentValueObjectTypeConverter.cs rename src/{BUTR.Site.NexusMods.Server/Utils/CopyHelper.cs => BUTR.Site.NexusMods.Server.ValueObjects.TVO/Utils/_CopyHelper.cs} (92%) create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/Utils/_QueryableHelper.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/BUTR.Site.NexusMods.Server.ValueObjects.Vogen.csproj create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/BUTR.Site.NexusMods.Server.ValueObjects.Vogen.csproj.DotSettings create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Extensions/EfCoreExtensions.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Extensions/OpenApiExtensions.cs rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/ApplicationRole.cs (74%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/CrashReportFileId.cs (86%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/CrashReportId.cs (87%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/CrashReportUrl.cs (86%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/CrashReportVersion.cs (87%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/ExceptionTypeId.cs (86%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/GameVersion.cs (87%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/ModuleId.cs (86%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/ModuleVersion.cs (86%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsApiKey.cs (82%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsArticleId.cs (87%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsFileId.cs (87%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsGameDomain.cs (84%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsModId.cs (89%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsUserEMail.cs (85%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsUserId.cs (90%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/NexusModsUserName.cs (85%) rename src/{BUTR.Site.NexusMods.Server/Models/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models}/TenantId.cs (83%) create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Usings.cs rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/IHasCopy.cs (60%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/IHasDefaultValue.cs (65%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/IHasDeserialize.cs (70%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/IHasIsInitialized.cs (65%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/IHasRandomValueGenerator.cs (79%) create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils/IVogen.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils/IVogenParsable.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils/IVogenSpanParsable.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils/IVogenUtf8SpanParsable.cs rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenDefaults.cs (94%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenDefaultsParsable.cs (88%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenDefaultsRandomValueGenerator.cs (80%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenDefaultsSpanParsable.cs (89%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenDefaultsUtf8SpanParsable.cs (89%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenJsonConverter.cs (90%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenSchemaFilter.cs (81%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenTypeConverter.cs (90%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenValueComparer.cs (74%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenValueComparerReference.cs (67%) rename src/{BUTR.Site.NexusMods.Server/Utils/Vogen => BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils}/VogenValueConverter.cs (68%) create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils/_CopyHelper.cs create mode 100644 src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Utils/_QueryableHelper.cs create mode 100644 src/BUTR.Site.NexusMods.Server/Contexts/Configs/IEntityConfiguration.cs create mode 100644 src/BUTR.Site.NexusMods.Server/Contexts/NpgsqlDataSourceProvider.cs delete mode 100644 src/BUTR.Site.NexusMods.Server/Extensions/VogenExtensions.cs rename src/BUTR.Site.NexusMods.Server/Services/{BannerlordBinaryCache.cs => SteamBinaryCache.cs} (87%) delete mode 100644 src/BUTR.Site.NexusMods.Server/Utils/Npgsql/ImmutableArrayToArrayConverter.cs delete mode 100644 src/BUTR.Site.NexusMods.Server/Utils/Vogen/IVogen.cs create mode 100644 src/BUTR.Site.NexusMods.Shared/BUTR.Site.NexusMods.Shared.csproj.DotSettings diff --git a/build/common.props b/build/common.props index ebea4915..362b5285 100644 --- a/build/common.props +++ b/build/common.props @@ -16,7 +16,7 @@ - + diff --git a/src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj b/src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj index 266b0139..55d9ad2d 100644 --- a/src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj +++ b/src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj @@ -17,26 +17,26 @@ - - - - - - - - - + + + + + + + + + - - - - - + + + + + - - + +