diff --git a/DotnetToLambda.sln b/DotnetToLambda.sln
index 96087be..18d04bb 100644
--- a/DotnetToLambda.sln
+++ b/DotnetToLambda.sln
@@ -138,18 +138,6 @@ Global
{1EB6729D-9846-441F-9C09-5F7CD563C0CE}.Release|x64.Build.0 = Release|Any CPU
{1EB6729D-9846-441F-9C09-5F7CD563C0CE}.Release|x86.ActiveCfg = Release|Any CPU
{1EB6729D-9846-441F-9C09-5F7CD563C0CE}.Release|x86.Build.0 = Release|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Debug|x64.ActiveCfg = Debug|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Debug|x64.Build.0 = Debug|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Debug|x86.Build.0 = Debug|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Release|Any CPU.Build.0 = Release|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Release|x64.ActiveCfg = Release|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Release|x64.Build.0 = Release|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Release|x86.ActiveCfg = Release|Any CPU
- {9BEB806D-2444-40FD-8871-E13174E291B1}.Release|x86.Build.0 = Release|Any CPU
{3630969D-0CBF-443D-9894-4DAC15B9D947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3630969D-0CBF-443D-9894-4DAC15B9D947}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3630969D-0CBF-443D-9894-4DAC15B9D947}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -187,7 +175,6 @@ Global
{5B35C029-27CE-44ED-AFEF-A646F2CEC096} = {163A600C-DD7F-436D-A8B5-32F69D7041C5}
{43C59108-87C5-4F4B-81D8-481CDE6C2D6D} = {163A600C-DD7F-436D-A8B5-32F69D7041C5}
{1EB6729D-9846-441F-9C09-5F7CD563C0CE} = {163A600C-DD7F-436D-A8B5-32F69D7041C5}
- {9BEB806D-2444-40FD-8871-E13174E291B1} = {12000098-E55C-49C0-B224-2027315833DB}
{3630969D-0CBF-443D-9894-4DAC15B9D947} = {163A600C-DD7F-436D-A8B5-32F69D7041C5}
{B4F8269C-8734-4F4D-8D17-E933EC07A054} = {6A524563-A123-4814-85AD-BD64EBA01BDF}
EndGlobalSection
diff --git a/NuGet.Config b/NuGet.Config
new file mode 100644
index 0000000..4d736c1
--- /dev/null
+++ b/NuGet.Config
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/docker-compose.yml b/docker-compose.yml
index e13f9b0..e08d313 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,4 @@
# Use root/example as user/password credentials
-version: '3.1'
-
services:
db:
image: mysql
@@ -9,4 +7,4 @@ services:
environment:
MYSQL_ROOT_PASSWORD: example
ports:
- - "3306:3306"
\ No newline at end of file
+ - "3306:3306"
diff --git a/global.json b/global.json
index 5a5a25a..1e7fdfa 100644
--- a/global.json
+++ b/global.json
@@ -1,5 +1,6 @@
{
"sdk": {
- "version": "3.1.416"
+ "version": "10.0.100",
+ "rollForward": "latestMinor"
}
-}
\ No newline at end of file
+}
diff --git a/src/DotnetToLambda.Api/DotnetToLambda.Api/DotnetToLambda.Api.csproj b/src/DotnetToLambda.Api/DotnetToLambda.Api/DotnetToLambda.Api.csproj
index 00f3e70..1afb89c 100644
--- a/src/DotnetToLambda.Api/DotnetToLambda.Api/DotnetToLambda.Api.csproj
+++ b/src/DotnetToLambda.Api/DotnetToLambda.Api/DotnetToLambda.Api.csproj
@@ -1,12 +1,13 @@
- netcoreapp3.1
+ net10.0
+ enable
+ enable
-
diff --git a/src/DotnetToLambda.Api/DotnetToLambda.Api/Program.cs b/src/DotnetToLambda.Api/DotnetToLambda.Api/Program.cs
index f89edf5..03618b6 100644
--- a/src/DotnetToLambda.Api/DotnetToLambda.Api/Program.cs
+++ b/src/DotnetToLambda.Api/DotnetToLambda.Api/Program.cs
@@ -1,26 +1,38 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
-
-namespace DotnetToLambda.Api
+using DotnetToLambda.Core.Models;
+using DotnetToLambda.Core.Infrastructure;
+using DotnetToLambda.Core.Services;
+using Microsoft.EntityFrameworkCore;
+
+var builder = WebApplication.CreateBuilder(args);
+
+var databaseConnection =
+ new DatabaseConnection(builder.Configuration.GetConnectionString("DatabaseConnection")!);
+
+builder.Services.AddSingleton(databaseConnection);
+
+builder.Services.AddDbContext(options =>
+ options.UseMySQL(databaseConnection.ToString()));
+
+builder.Services.AddTransient();
+builder.Services.AddHttpClient();
+
+builder.Services.AddControllers();
+
+var app = builder.Build();
+
+if (app.Environment.IsDevelopment())
+{
+ app.UseDeveloperExceptionPage();
+}
+
+using (var scope = app.Services.CreateScope())
{
- public class Program
- {
- public static void Main(string[] args)
- {
- CreateHostBuilder(args).Build().Run();
- }
-
- public static IHostBuilder CreateHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup();
- });
- }
+ var context = scope.ServiceProvider.GetRequiredService();
+ context.Database.Migrate();
}
+
+app.UseRouting();
+app.UseAuthorization();
+app.MapControllers();
+
+app.Run();
diff --git a/src/DotnetToLambda.Api/DotnetToLambda.Api/Startup.cs b/src/DotnetToLambda.Api/DotnetToLambda.Api/Startup.cs
deleted file mode 100644
index 5870358..0000000
--- a/src/DotnetToLambda.Api/DotnetToLambda.Api/Startup.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using DotnetToLambda.Core.Models;
-using DotnetToLambda.Core.Infrastructure;
-using DotnetToLambda.Core.Services;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
-namespace DotnetToLambda.Api
-{
- public class Startup
- {
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
-
- public IConfiguration Configuration { get; }
-
- // This method gets called by the runtime. Use this method to add services to the container.
- public void ConfigureServices(IServiceCollection services)
- {
- var databaseConnection =
- new DatabaseConnection(this.Configuration.GetConnectionString("DatabaseConnection"));
-
- services.AddSingleton(databaseConnection);
-
- services.AddDbContext(options =>
- options.UseMySQL(databaseConnection.ToString()));
-
- services.AddTransient();
- services.AddHttpClient();
-
- services.AddControllers();
- }
-
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- }
-
- using (var serviceScope = app.ApplicationServices.CreateScope())
- {
- var context = serviceScope.ServiceProvider.GetRequiredService();
- context.Database.Migrate();
- }
-
- app.UseRouting();
-
- app.UseAuthorization();
-
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- });
- }
- }
-}
diff --git a/src/DotnetToLambda.Api/DotnetToLambda.Core/DotnetToLambda.Core.csproj b/src/DotnetToLambda.Api/DotnetToLambda.Core/DotnetToLambda.Core.csproj
index 49196da..fe7545a 100644
--- a/src/DotnetToLambda.Api/DotnetToLambda.Core/DotnetToLambda.Core.csproj
+++ b/src/DotnetToLambda.Api/DotnetToLambda.Core/DotnetToLambda.Core.csproj
@@ -1,19 +1,23 @@
- netstandard2.0
+ net10.0
+ enable
+ enable
-
-
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/src/DotnetToLambda.Api/DotnetToLambda.Core/Infrastructure/BookingContext.cs b/src/DotnetToLambda.Api/DotnetToLambda.Core/Infrastructure/BookingContext.cs
index 37220a3..ca7b46f 100644
--- a/src/DotnetToLambda.Api/DotnetToLambda.Core/Infrastructure/BookingContext.cs
+++ b/src/DotnetToLambda.Api/DotnetToLambda.Core/Infrastructure/BookingContext.cs
@@ -1,34 +1,32 @@
using DotnetToLambda.Core.Models;
using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-namespace DotnetToLambda.Core.Infrastructure
+namespace DotnetToLambda.Core.Infrastructure;
+
+public class BookingContext : DbContext
{
- public class BookingContext : DbContext
+ private readonly DatabaseConnection _connection;
+
+ public BookingContext(DatabaseConnection connection)
{
- private readonly DatabaseConnection _connection;
+ _connection = connection;
+ }
- public BookingContext(DatabaseConnection connection)
- {
- this._connection = connection;
- }
-
- public DbSet Bookings { get; set; }
+ public DbSet Bookings { get; set; } = null!;
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.UseMySQL(this._connection.ToString());
- }
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseMySQL(_connection.ToString());
+ }
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity().ToTable("Bookings");
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ modelBuilder.Entity().ToTable("Bookings");
- modelBuilder.Entity()
- .HasKey(b => b.BookingId).HasName("PK_BookingId");
- modelBuilder.Entity()
- .HasIndex(b => b.CustomerId)
- .HasName("UX_Booking_CustomerId");
- }
+ modelBuilder.Entity()
+ .HasKey(b => b.BookingId).HasName("PK_BookingId");
+ modelBuilder.Entity()
+ .HasIndex(b => b.CustomerId)
+ .HasDatabaseName("UX_Booking_CustomerId");
}
-}
\ No newline at end of file
+}
diff --git a/src/infrastructure/src/Infrastructure/Infrastructure.csproj b/src/infrastructure/src/Infrastructure/Infrastructure.csproj
index f75b87c..b195ccd 100644
--- a/src/infrastructure/src/Infrastructure/Infrastructure.csproj
+++ b/src/infrastructure/src/Infrastructure/Infrastructure.csproj
@@ -2,15 +2,15 @@
Exe
- netcoreapp3.1
-
- Major
+ net10.0
+ enable
+ enable
-
-
+
+