From 91ab145b858a977677241530b945391cacf2b8fa Mon Sep 17 00:00:00 2001 From: daniel-c-harvey Date: Sat, 30 Aug 2025 22:02:29 -0400 Subject: [PATCH] DeepDrftWeb startup & setup --- DeepDrftHome.sln | 18 ++++++++++++++++++ DeepDrftWeb/DeepDrftWeb/Program.cs | 14 ++++++++++---- DeepDrftWeb/DeepDrftWeb/Startup.cs | 21 +++++++++++++++++++++ DeepDrftWeb/DeepDrftWeb/appsettings.json | 5 ++++- 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 DeepDrftWeb/DeepDrftWeb/Startup.cs diff --git a/DeepDrftHome.sln b/DeepDrftHome.sln index d5d4a6a..50f7194 100644 --- a/DeepDrftHome.sln +++ b/DeepDrftHome.sln @@ -4,6 +4,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftWeb", "DeepDrftWeb\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftWeb.Client", "DeepDrftWeb\DeepDrftWeb.Client\DeepDrftWeb.Client.csproj", "{E76D21B4-308B-487B-B8D6-59D6AE49F1F7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftModels", "DeepDrftModels\DeepDrftModels.csproj", "{10CE5160-16C3-4CB1-9E2E-52467BA80B4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftContent", "DeepDrftContent\DeepDrftContent.csproj", "{C79AFD08-02C0-45D2-A98A-FCDDFBEAE155}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetBlocks", "C:\lib\NetBlocks\NetBlocks.csproj", "{EEB3A665-B8AD-4C00-A41E-B9D8AFE1BBA8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -18,5 +24,17 @@ Global {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Release|Any CPU.Build.0 = Release|Any CPU + {10CE5160-16C3-4CB1-9E2E-52467BA80B4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10CE5160-16C3-4CB1-9E2E-52467BA80B4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10CE5160-16C3-4CB1-9E2E-52467BA80B4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10CE5160-16C3-4CB1-9E2E-52467BA80B4B}.Release|Any CPU.Build.0 = Release|Any CPU + {C79AFD08-02C0-45D2-A98A-FCDDFBEAE155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C79AFD08-02C0-45D2-A98A-FCDDFBEAE155}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C79AFD08-02C0-45D2-A98A-FCDDFBEAE155}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C79AFD08-02C0-45D2-A98A-FCDDFBEAE155}.Release|Any CPU.Build.0 = Release|Any CPU + {EEB3A665-B8AD-4C00-A41E-B9D8AFE1BBA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEB3A665-B8AD-4C00-A41E-B9D8AFE1BBA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEB3A665-B8AD-4C00-A41E-B9D8AFE1BBA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEB3A665-B8AD-4C00-A41E-B9D8AFE1BBA8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/DeepDrftWeb/DeepDrftWeb/Program.cs b/DeepDrftWeb/DeepDrftWeb/Program.cs index 45d1eae..4c37fbb 100644 --- a/DeepDrftWeb/DeepDrftWeb/Program.cs +++ b/DeepDrftWeb/DeepDrftWeb/Program.cs @@ -1,12 +1,19 @@ +using DeepDrftWeb; using MudBlazor.Services; -using DeepDrftWeb.Client.Pages; using DeepDrftWeb.Components; +using DeepDrftWeb.Data; +using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); // Add MudBlazor services builder.Services.AddMudServices(); +Startup.ConfigureDomainServices(builder); + + +builder.Services.AddControllers(); + // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents() @@ -24,14 +31,13 @@ else app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); + app.UseHttpsRedirection(); } -app.UseHttpsRedirection(); - - app.UseAntiforgery(); app.MapStaticAssets(); +app.MapControllers(); app.MapRazorComponents() .AddInteractiveServerRenderMode() .AddInteractiveWebAssemblyRenderMode() diff --git a/DeepDrftWeb/DeepDrftWeb/Startup.cs b/DeepDrftWeb/DeepDrftWeb/Startup.cs new file mode 100644 index 0000000..a61d3b1 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/Startup.cs @@ -0,0 +1,21 @@ +using DeepDrftWeb.Data; +using DeepDrftWeb.Data.Repositories; +using DeepDrftWeb.Services; +using Microsoft.EntityFrameworkCore; + +namespace DeepDrftWeb; + +public static class Startup +{ + public static void ConfigureDomainServices(WebApplicationBuilder builder) + { + // Add Entity Framework services + builder.Services.AddDbContext(options => + options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"))); + + // Add Track services + builder.Services.AddScoped(); + builder.Services.AddScoped(); + + } +} \ No newline at end of file diff --git a/DeepDrftWeb/DeepDrftWeb/appsettings.json b/DeepDrftWeb/DeepDrftWeb/appsettings.json index 10f68b8..658116a 100644 --- a/DeepDrftWeb/DeepDrftWeb/appsettings.json +++ b/DeepDrftWeb/DeepDrftWeb/appsettings.json @@ -5,5 +5,8 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "Data Source=deepdrft.db" + } }