From dd9b9b33033a5ad13b35fc8b1aa5ae90472b41cc Mon Sep 17 00:00:00 2001 From: mukesh Date: Fri, 17 Jul 2026 02:35:07 +0530 Subject: [PATCH] Migrate solution from .NET Core 3.1 to .NET 8 --- .../BankSystem.Common/BankSystem.Common.csproj | 8 ++++---- .../Utils/CryptographyExtensions.cs | 10 +++++----- .../BankSystem.Data/BankSystem.Data.csproj | 6 +++--- .../BankSystem.Data/BankSystemDbContext.cs | 8 ++++++++ .../BankSystem.Models/BankSystem.Models.csproj | 4 ++-- .../CentralApi.Data/CentralApi.Data.csproj | 6 +++--- .../CentralApi.Models/CentralApi.Models.csproj | 2 +- src/DemoShop/DemoShop.Data/DemoShop.Data.csproj | 12 ++++++------ .../DemoShop.Models/DemoShop.Models.csproj | 4 ++-- .../DemoShop.Services.Models.csproj | 2 +- .../DemoShop.Services/DemoShop.Services.csproj | 2 +- src/DemoShop/DemoShop.Web/DemoShop.Web.csproj | 7 ++++--- .../BankSystem.Services.Models.csproj | 2 +- .../BankSystem.Services/BankSystem.Services.csproj | 4 ++-- .../CentralApi.Services.Models.csproj | 2 +- .../CentralApi.Services/CentralApi.Services.csproj | 2 +- .../BankSystem.Services.Tests.csproj | 14 +++++++------- .../CentralApi.Services.Tests.csproj | 14 +++++++------- src/Web/Api/CentralApi/CentralApi.csproj | 5 +++-- src/Web/BankSystem.Web/BankSystem.Web.csproj | 7 ++++--- .../BankSystem.Web/Pages/Account/Register.cshtml | 3 ++- src/Web/BankSystem.Web/Startup.cs | 4 +++- src/Web/BankSystem.Web/appsettings.json | 6 +++--- 23 files changed, 74 insertions(+), 60 deletions(-) diff --git a/src/Common/BankSystem.Common/BankSystem.Common.csproj b/src/Common/BankSystem.Common/BankSystem.Common.csproj index 73bcfb2a..76820027 100644 --- a/src/Common/BankSystem.Common/BankSystem.Common.csproj +++ b/src/Common/BankSystem.Common/BankSystem.Common.csproj @@ -1,14 +1,14 @@ - netstandard2.1 + net8.0 8 - - - + + + diff --git a/src/Common/BankSystem.Common/Utils/CryptographyExtensions.cs b/src/Common/BankSystem.Common/Utils/CryptographyExtensions.cs index 7f8ea620..190ef413 100644 --- a/src/Common/BankSystem.Common/Utils/CryptographyExtensions.cs +++ b/src/Common/BankSystem.Common/Utils/CryptographyExtensions.cs @@ -8,7 +8,7 @@ public static class CryptographyExtensions { public static string[] GenerateKey() { - using (AesManaged aes = new AesManaged()) + using (Aes aes = Aes.Create()) { aes.GenerateKey(); aes.GenerateIV(); @@ -20,8 +20,8 @@ public static string[] GenerateKey() public static byte[] Encrypt(string plainText, byte[] Key, byte[] IV) { byte[] encrypted; - // Create a new AesManaged. - using (AesManaged aes = new AesManaged()) + // Create a new Aes instance. + using (Aes aes = Aes.Create()) { // Create encryptor ICryptoTransform encryptor = aes.CreateEncryptor(Key, IV); @@ -48,8 +48,8 @@ public static byte[] Encrypt(string plainText, byte[] Key, byte[] IV) public static string Decrypt(byte[] cipherText, byte[] Key, byte[] IV) { string plaintext = null; - // Create AesManaged - using (AesManaged aes = new AesManaged()) + // Create Aes instance + using (Aes aes = Aes.Create()) { // Create a decryptor ICryptoTransform decryptor = aes.CreateDecryptor(Key, IV); diff --git a/src/Data/BankSystem/BankSystem.Data/BankSystem.Data.csproj b/src/Data/BankSystem/BankSystem.Data/BankSystem.Data.csproj index 5ddf1c56..454f600f 100644 --- a/src/Data/BankSystem/BankSystem.Data/BankSystem.Data.csproj +++ b/src/Data/BankSystem/BankSystem.Data/BankSystem.Data.csproj @@ -1,13 +1,13 @@ - netstandard2.1 + net8.0 8 - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Data/BankSystem/BankSystem.Data/BankSystemDbContext.cs b/src/Data/BankSystem/BankSystem.Data/BankSystemDbContext.cs index 99fe9a1b..31300555 100644 --- a/src/Data/BankSystem/BankSystem.Data/BankSystemDbContext.cs +++ b/src/Data/BankSystem/BankSystem.Data/BankSystemDbContext.cs @@ -22,6 +22,14 @@ protected override void OnModelCreating(ModelBuilder builder) { builder.ApplyConfiguration(new UserConfiguration()); + builder.Entity() + .Property(e => e.Balance) + .HasPrecision(18, 4); + + builder.Entity() + .Property(e => e.Amount) + .HasPrecision(18, 4); + base.OnModelCreating(builder); } } diff --git a/src/Data/BankSystem/BankSystem.Models/BankSystem.Models.csproj b/src/Data/BankSystem/BankSystem.Models/BankSystem.Models.csproj index d28ea3a5..85a5920b 100644 --- a/src/Data/BankSystem/BankSystem.Models/BankSystem.Models.csproj +++ b/src/Data/BankSystem/BankSystem.Models/BankSystem.Models.csproj @@ -1,12 +1,12 @@ - netstandard2.1 + net8.0 8 - + diff --git a/src/Data/CentralApi/CentralApi.Data/CentralApi.Data.csproj b/src/Data/CentralApi/CentralApi.Data/CentralApi.Data.csproj index 262e9ec0..ff43da55 100644 --- a/src/Data/CentralApi/CentralApi.Data/CentralApi.Data.csproj +++ b/src/Data/CentralApi/CentralApi.Data/CentralApi.Data.csproj @@ -1,13 +1,13 @@ - netstandard2.1 + net8.0 8 - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Data/CentralApi/CentralApi.Models/CentralApi.Models.csproj b/src/Data/CentralApi/CentralApi.Models/CentralApi.Models.csproj index aeb9dd65..a191d875 100644 --- a/src/Data/CentralApi/CentralApi.Models/CentralApi.Models.csproj +++ b/src/Data/CentralApi/CentralApi.Models/CentralApi.Models.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + net8.0 8 diff --git a/src/DemoShop/DemoShop.Data/DemoShop.Data.csproj b/src/DemoShop/DemoShop.Data/DemoShop.Data.csproj index 8bd343fc..b4f6d87d 100644 --- a/src/DemoShop/DemoShop.Data/DemoShop.Data.csproj +++ b/src/DemoShop/DemoShop.Data/DemoShop.Data.csproj @@ -1,19 +1,19 @@  - netstandard2.1 + net8.0 8 - - - - + + + + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/DemoShop/DemoShop.Models/DemoShop.Models.csproj b/src/DemoShop/DemoShop.Models/DemoShop.Models.csproj index 6fc11019..3cdc85d1 100644 --- a/src/DemoShop/DemoShop.Models/DemoShop.Models.csproj +++ b/src/DemoShop/DemoShop.Models/DemoShop.Models.csproj @@ -1,12 +1,12 @@  - netstandard2.1 + net8.0 8 - + diff --git a/src/DemoShop/DemoShop.Services.Models/DemoShop.Services.Models.csproj b/src/DemoShop/DemoShop.Services.Models/DemoShop.Services.Models.csproj index 06c571ad..deb02802 100644 --- a/src/DemoShop/DemoShop.Services.Models/DemoShop.Services.Models.csproj +++ b/src/DemoShop/DemoShop.Services.Models/DemoShop.Services.Models.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net8.0 8 diff --git a/src/DemoShop/DemoShop.Services/DemoShop.Services.csproj b/src/DemoShop/DemoShop.Services/DemoShop.Services.csproj index 9b5d80c3..d8797306 100644 --- a/src/DemoShop/DemoShop.Services/DemoShop.Services.csproj +++ b/src/DemoShop/DemoShop.Services/DemoShop.Services.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net8.0 8 diff --git a/src/DemoShop/DemoShop.Web/DemoShop.Web.csproj b/src/DemoShop/DemoShop.Web/DemoShop.Web.csproj index 6a13afa1..94eac010 100644 --- a/src/DemoShop/DemoShop.Web/DemoShop.Web.csproj +++ b/src/DemoShop/DemoShop.Web/DemoShop.Web.csproj @@ -1,15 +1,16 @@  - netcoreapp3.1 + + net8.0 aspnet-DemoShop.Web-BB3CD731-A190-4BBC-999C-8696320258E3 InProcess 8 - - + + diff --git a/src/Services/BankSystem/BankSystem.Services.Models/BankSystem.Services.Models.csproj b/src/Services/BankSystem/BankSystem.Services.Models/BankSystem.Services.Models.csproj index 35fb77a2..45dc71b3 100644 --- a/src/Services/BankSystem/BankSystem.Services.Models/BankSystem.Services.Models.csproj +++ b/src/Services/BankSystem/BankSystem.Services.Models/BankSystem.Services.Models.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + net8.0 8 diff --git a/src/Services/BankSystem/BankSystem.Services/BankSystem.Services.csproj b/src/Services/BankSystem/BankSystem.Services/BankSystem.Services.csproj index ac3f32b3..37b0ede8 100644 --- a/src/Services/BankSystem/BankSystem.Services/BankSystem.Services.csproj +++ b/src/Services/BankSystem/BankSystem.Services/BankSystem.Services.csproj @@ -1,12 +1,12 @@  - netstandard2.1 + net8.0 8 - + diff --git a/src/Services/CentralApi/CentralApi.Services.Models/CentralApi.Services.Models.csproj b/src/Services/CentralApi/CentralApi.Services.Models/CentralApi.Services.Models.csproj index d49b3b15..d1e94f3d 100644 --- a/src/Services/CentralApi/CentralApi.Services.Models/CentralApi.Services.Models.csproj +++ b/src/Services/CentralApi/CentralApi.Services.Models/CentralApi.Services.Models.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + net8.0 8 diff --git a/src/Services/CentralApi/CentralApi.Services/CentralApi.Services.csproj b/src/Services/CentralApi/CentralApi.Services/CentralApi.Services.csproj index 002c9455..d8aa9f17 100644 --- a/src/Services/CentralApi/CentralApi.Services/CentralApi.Services.csproj +++ b/src/Services/CentralApi/CentralApi.Services/CentralApi.Services.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + net8.0 8 diff --git a/src/Tests/BankSystem.Services.Tests/BankSystem.Services.Tests.csproj b/src/Tests/BankSystem.Services.Tests/BankSystem.Services.Tests.csproj index 37b24059..f0806567 100644 --- a/src/Tests/BankSystem.Services.Tests/BankSystem.Services.Tests.csproj +++ b/src/Tests/BankSystem.Services.Tests/BankSystem.Services.Tests.csproj @@ -1,19 +1,19 @@  - netcoreapp3.1 + net8.0 8 - - + + - - + + - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Tests/CentralApi.Services.Tests/CentralApi.Services.Tests.csproj b/src/Tests/CentralApi.Services.Tests/CentralApi.Services.Tests.csproj index fe2ee2ae..58ab9056 100644 --- a/src/Tests/CentralApi.Services.Tests/CentralApi.Services.Tests.csproj +++ b/src/Tests/CentralApi.Services.Tests/CentralApi.Services.Tests.csproj @@ -1,19 +1,19 @@  - netcoreapp3.1 + net8.0 8 - - + + - - + + - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Web/Api/CentralApi/CentralApi.csproj b/src/Web/Api/CentralApi/CentralApi.csproj index 1d67b4fd..4dfa20a2 100644 --- a/src/Web/Api/CentralApi/CentralApi.csproj +++ b/src/Web/Api/CentralApi/CentralApi.csproj @@ -1,14 +1,15 @@ - netcoreapp3.1 + + net8.0 InProcess 8 - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Web/BankSystem.Web/BankSystem.Web.csproj b/src/Web/BankSystem.Web/BankSystem.Web.csproj index d70f9c32..68075129 100644 --- a/src/Web/BankSystem.Web/BankSystem.Web.csproj +++ b/src/Web/BankSystem.Web/BankSystem.Web.csproj @@ -1,7 +1,8 @@  - netcoreapp3.1 + + net8.0 aspnet-BankSystem.Web-664D3A45-CFBD-494E-9D86-DE3896B36D95 InProcess 8 @@ -11,8 +12,8 @@ - - + + diff --git a/src/Web/BankSystem.Web/Pages/Account/Register.cshtml b/src/Web/BankSystem.Web/Pages/Account/Register.cshtml index 425ae587..bd03553b 100644 --- a/src/Web/BankSystem.Web/Pages/Account/Register.cshtml +++ b/src/Web/BankSystem.Web/Pages/Account/Register.cshtml @@ -39,4 +39,5 @@ @section Scripts { -} \ No newline at end of file +} + diff --git a/src/Web/BankSystem.Web/Startup.cs b/src/Web/BankSystem.Web/Startup.cs index ef802960..d4fe44dc 100644 --- a/src/Web/BankSystem.Web/Startup.cs +++ b/src/Web/BankSystem.Web/Startup.cs @@ -42,6 +42,8 @@ public void ConfigureServices(IServiceCollection services) options.UseSqlServer( this.Configuration.GetConnectionString("DefaultConnection"))); + services.AddDatabaseDeveloperPageExceptionFilter(); + services .Configure(options => { options.Cookie.IsEssential = true; }); @@ -117,7 +119,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); - app.UseDatabaseErrorPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/Web/BankSystem.Web/appsettings.json b/src/Web/BankSystem.Web/appsettings.json index 14b552d4..7c6d0130 100644 --- a/src/Web/BankSystem.Web/appsettings.json +++ b/src/Web/BankSystem.Web/appsettings.json @@ -15,9 +15,9 @@ "SendGridConfiguration": { "ApiKey": "Your SendGrid Api Key" }, - "ConnectionStrings": { - "DefaultConnection": "Server=.;Database=BankSystem;Trusted_Connection=True;MultipleActiveResultSets=true" - }, + "ConnectionStrings": { + "DefaultConnection": "Server=.;Database=BankSystem;Trusted_Connection=True;MultipleActiveResultSets=true" +}, "Logging": { "LogLevel": { "Default": "Warning"