From 9ef501627300f572598089080ce9e10542696efa Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 4 Jan 2024 13:48:50 -0800 Subject: [PATCH 1/6] Adding OrchardCore sample solution with plain ASP.NET Core project (No OC yet and everything is working) --- .../Aspire.AppHost/Aspire.AppHost.csproj | 20 +++ .../Aspire/Aspire.AppHost/Program.cs | 10 ++ .../Properties/launchSettings.json | 16 +++ .../appsettings.Development.json | 8 ++ .../Aspire/Aspire.AppHost/appsettings.json | 9 ++ .../Aspire.ServiceDefaults.csproj | 24 ++++ .../Aspire.ServiceDefaults/Extensions.cs | 119 ++++++++++++++++++ .../OrchardCore.Cms/OrchardCore.Cms.csproj | 13 ++ .../OrchardCore/OrchardCore.Cms/Program.cs | 10 ++ .../Properties/launchSettings.json | 38 ++++++ .../appsettings.Development.json | 8 ++ .../OrchardCore.Cms/appsettings.json | 9 ++ .../OrchardCore.Mvc/OrchardCore.Mvc.csproj | 13 ++ .../OrchardCore/OrchardCore.Mvc/Program.cs | 10 ++ .../Properties/launchSettings.json | 38 ++++++ .../appsettings.Development.json | 8 ++ .../OrchardCore.Mvc/appsettings.json | 9 ++ samples/OrchardCore/OrchardCore.sln | 43 +++++++ 18 files changed, 405 insertions(+) create mode 100644 samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj create mode 100644 samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs create mode 100644 samples/OrchardCore/Aspire/Aspire.AppHost/Properties/launchSettings.json create mode 100644 samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.Development.json create mode 100644 samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.json create mode 100644 samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Aspire.ServiceDefaults.csproj create mode 100644 samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Extensions.cs create mode 100644 samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj create mode 100644 samples/OrchardCore/OrchardCore.Cms/Program.cs create mode 100644 samples/OrchardCore/OrchardCore.Cms/Properties/launchSettings.json create mode 100644 samples/OrchardCore/OrchardCore.Cms/appsettings.Development.json create mode 100644 samples/OrchardCore/OrchardCore.Cms/appsettings.json create mode 100644 samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj create mode 100644 samples/OrchardCore/OrchardCore.Mvc/Program.cs create mode 100644 samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json create mode 100644 samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json create mode 100644 samples/OrchardCore/OrchardCore.Mvc/appsettings.json create mode 100644 samples/OrchardCore/OrchardCore.sln diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj b/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj new file mode 100644 index 00000000..7e925aa0 --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + true + + + + + + + + + + + + diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs b/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs new file mode 100644 index 00000000..1b81328b --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs @@ -0,0 +1,10 @@ +var builder = DistributedApplication.CreateBuilder(args); + +var redis = builder.AddRedisContainer("Redis", 50963); + +builder.AddProject("OrchardCore CMS") + .WithReference(redis); + +builder.AddProject("OrchardCore MVC"); + +builder.Build().Run(); diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Properties/launchSettings.json b/samples/OrchardCore/Aspire/Aspire.AppHost/Properties/launchSettings.json new file mode 100644 index 00000000..42a35b84 --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Properties/launchSettings.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:15264", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16296" + } + } + } +} diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.Development.json b/samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.json b/samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.json new file mode 100644 index 00000000..31c092aa --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Aspire.Hosting.Dcp": "Warning" + } + } +} diff --git a/samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Aspire.ServiceDefaults.csproj b/samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Aspire.ServiceDefaults.csproj new file mode 100644 index 00000000..30d5c1fb --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Aspire.ServiceDefaults.csproj @@ -0,0 +1,24 @@ + + + + Library + net8.0 + enable + enable + true + + + + + + + + + + + + + + + + diff --git a/samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Extensions.cs b/samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Extensions.cs new file mode 100644 index 00000000..c59308d5 --- /dev/null +++ b/samples/OrchardCore/Aspire/Aspire.ServiceDefaults/Extensions.cs @@ -0,0 +1,119 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Diagnostics.HealthChecks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Logging; +using OpenTelemetry.Logs; +using OpenTelemetry.Metrics; +using OpenTelemetry.Trace; + +namespace Microsoft.Extensions.Hosting; + +public static class Extensions +{ + public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder) + { + builder.ConfigureOpenTelemetry(); + + builder.AddDefaultHealthChecks(); + + builder.Services.AddServiceDiscovery(); + + builder.Services.ConfigureHttpClientDefaults(http => + { + // Turn on resilience by default + http.AddStandardResilienceHandler(); + + // Turn on service discovery by default + http.UseServiceDiscovery(); + }); + + return builder; + } + + public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicationBuilder builder) + { + builder.Logging.AddOpenTelemetry(logging => + { + logging.IncludeFormattedMessage = true; + logging.IncludeScopes = true; + }); + + builder.Services.AddOpenTelemetry() + .WithMetrics(metrics => + { + metrics.AddRuntimeInstrumentation() + .AddBuiltInMeters(); + }) + .WithTracing(tracing => + { + if (builder.Environment.IsDevelopment()) + { + // We want to view all traces in development + tracing.SetSampler(new AlwaysOnSampler()); + } + + tracing.AddAspNetCoreInstrumentation() + .AddGrpcClientInstrumentation() + .AddHttpClientInstrumentation(); + }); + + builder.AddOpenTelemetryExporters(); + + return builder; + } + + private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostApplicationBuilder builder) + { + var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]); + + if (useOtlpExporter) + { + builder.Services.Configure(logging => logging.AddOtlpExporter()); + builder.Services.ConfigureOpenTelemetryMeterProvider(metrics => metrics.AddOtlpExporter()); + builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddOtlpExporter()); + } + + // Uncomment the following lines to enable the Prometheus exporter (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package) + // builder.Services.AddOpenTelemetry() + // .WithMetrics(metrics => metrics.AddPrometheusExporter()); + + // Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.Exporter package) + // builder.Services.AddOpenTelemetry() + // .UseAzureMonitor(); + + return builder; + } + + public static IHostApplicationBuilder AddDefaultHealthChecks(this IHostApplicationBuilder builder) + { + builder.Services.AddHealthChecks() + // Add a default liveness check to ensure app is responsive + .AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]); + + return builder; + } + + public static WebApplication MapDefaultEndpoints(this WebApplication app) + { + // Uncomment the following line to enable the Prometheus endpoint (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package) + // app.MapPrometheusScrapingEndpoint(); + + // All health checks must pass for app to be considered ready to accept traffic after starting + app.MapHealthChecks("/health"); + + // Only health checks tagged with the "live" tag must pass for app to be considered alive + app.MapHealthChecks("/alive", new HealthCheckOptions + { + Predicate = r => r.Tags.Contains("live") + }); + + return app; + } + + private static MeterProviderBuilder AddBuiltInMeters(this MeterProviderBuilder meterProviderBuilder) => + meterProviderBuilder.AddMeter( + "Microsoft.AspNetCore.Hosting", + "Microsoft.AspNetCore.Server.Kestrel", + "System.Net.Http"); +} diff --git a/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj b/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj new file mode 100644 index 00000000..00f936c9 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/samples/OrchardCore/OrchardCore.Cms/Program.cs b/samples/OrchardCore/OrchardCore.Cms/Program.cs new file mode 100644 index 00000000..84699389 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Cms/Program.cs @@ -0,0 +1,10 @@ +var builder = WebApplication.CreateBuilder(args); + +builder.AddServiceDefaults(); +var app = builder.Build(); + +app.MapDefaultEndpoints(); + +app.MapGet("/", () => "CMS App"); + +app.Run(); diff --git a/samples/OrchardCore/OrchardCore.Cms/Properties/launchSettings.json b/samples/OrchardCore/OrchardCore.Cms/Properties/launchSettings.json new file mode 100644 index 00000000..2efeda50 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Cms/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:54444", + "sslPort": 44359 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5090", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7065;http://localhost:5090", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Cms/appsettings.Development.json b/samples/OrchardCore/OrchardCore.Cms/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Cms/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Cms/appsettings.json b/samples/OrchardCore/OrchardCore.Cms/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Cms/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj b/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj new file mode 100644 index 00000000..00f936c9 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/samples/OrchardCore/OrchardCore.Mvc/Program.cs b/samples/OrchardCore/OrchardCore.Mvc/Program.cs new file mode 100644 index 00000000..eb4a853a --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/Program.cs @@ -0,0 +1,10 @@ +var builder = WebApplication.CreateBuilder(args); + +builder.AddServiceDefaults(); +var app = builder.Build(); + +app.MapDefaultEndpoints(); + +app.MapGet("/", () => "MVC App"); + +app.Run(); diff --git a/samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json b/samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json new file mode 100644 index 00000000..ddbbcaaa --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:46492", + "sslPort": 44382 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5175", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7025;http://localhost:5175", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json b/samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Mvc/appsettings.json b/samples/OrchardCore/OrchardCore.Mvc/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/OrchardCore/OrchardCore.sln b/samples/OrchardCore/OrchardCore.sln new file mode 100644 index 00000000..50e9d67e --- /dev/null +++ b/samples/OrchardCore/OrchardCore.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34407.89 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.AppHost", "Aspire\Aspire.AppHost\Aspire.AppHost.csproj", "{402C833F-9FCE-4557-84D4-3AAAF74C8DE8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.ServiceDefaults", "Aspire\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj", "{DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Cms", "OrchardCore.Cms\OrchardCore.Cms.csproj", "{58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Mvc", "OrchardCore.Mvc\OrchardCore.Mvc.csproj", "{54B7339E-AB80-4E01-B102-753A2420D695}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {402C833F-9FCE-4557-84D4-3AAAF74C8DE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {402C833F-9FCE-4557-84D4-3AAAF74C8DE8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {402C833F-9FCE-4557-84D4-3AAAF74C8DE8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {402C833F-9FCE-4557-84D4-3AAAF74C8DE8}.Release|Any CPU.Build.0 = Release|Any CPU + {DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD}.Release|Any CPU.Build.0 = Release|Any CPU + {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Release|Any CPU.Build.0 = Release|Any CPU + {54B7339E-AB80-4E01-B102-753A2420D695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54B7339E-AB80-4E01-B102-753A2420D695}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54B7339E-AB80-4E01-B102-753A2420D695}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54B7339E-AB80-4E01-B102-753A2420D695}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {77E10717-33F7-4C6D-94C3-9426C68D966C} + EndGlobalSection +EndGlobal From 7fecb172bd502fc8edb3aae88ea357ac21eba3b1 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 4 Jan 2024 14:39:52 -0800 Subject: [PATCH 2/6] Adding OrchardCore projects and a readme file --- .gitignore | 2 + Directory.Packages.props | 6 +- samples/OrchardCore/.gitignore | 177 ++++++++++++++++++ .../Aspire.AppHost/Aspire.AppHost.csproj | 1 + .../OrchardCore.Cms/OrchardCore.Cms.csproj | 4 + .../OrchardCore/OrchardCore.Cms/Program.cs | 14 +- .../Controllers/HomeController.cs | 12 ++ .../OrchardCore.Mvc.HelloWorld/Manifest.cs | 5 + .../OrchardCore.Mvc.HelloWorld.csproj | 17 ++ .../OrchardCore.Mvc.HelloWorld/Program.cs | 10 + .../Properties/launchSettings.json | 38 ++++ .../OrchardCore.Mvc.HelloWorld/Startup.cs | 16 ++ .../Views/Home/Index.cshtml | 5 + .../Views/_ViewImports.cshtml | 1 + .../Views/_ViewStart.cshtml | 3 + .../appsettings.Development.json | 8 + .../appsettings.json | 9 + .../OrchardCore.Mvc/OrchardCore.Mvc.csproj | 6 + .../OrchardCore/OrchardCore.Mvc/Program.cs | 16 +- .../Views/Shared/_Layout.cshtml | 24 +++ .../OrchardCore.Mvc/Views/_ViewImports.cshtml | 1 + .../OrchardCore.Mvc/Views/_ViewStart.cshtml | 3 + .../OrchardCore.Mvc/appsettings.json | 3 +- samples/OrchardCore/OrchardCore.sln | 22 +++ samples/OrchardCore/README.md | 51 +++++ 25 files changed, 446 insertions(+), 8 deletions(-) create mode 100644 samples/OrchardCore/.gitignore create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json create mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json create mode 100644 samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml create mode 100644 samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml create mode 100644 samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml create mode 100644 samples/OrchardCore/README.md diff --git a/.gitignore b/.gitignore index 8a30d258..a7acb830 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,5 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +/samples/OrchardCore/OrchardCore.Cms/App_Data +/samples/OrchardCore/OrchardCore.Cms/Localization diff --git a/Directory.Packages.props b/Directory.Packages.props index 6830a1eb..96ac9cf5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -48,7 +48,7 @@ - + @@ -64,6 +64,10 @@ + + + + diff --git a/samples/OrchardCore/.gitignore b/samples/OrchardCore/.gitignore new file mode 100644 index 00000000..65aefd5c --- /dev/null +++ b/samples/OrchardCore/.gitignore @@ -0,0 +1,177 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates +*.sln.ide/ + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +app.publish/ +[Bb]in/ +[Oo]bj/ + +# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets +!packages/*/build/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc +project.lock.json + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# CodeRush personal settings +.cr/personal + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# Rider is a IDE fm JetBrains +.idea + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.Cache +!OrchardCore.Environment.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + +# ========================= +# Orchard specifics +# ========================= + +App_Data*/ +.vs/ + +#enable all /lib artifacts +!lib/*/*.* + +#exclude node modules +node_modules/ + +wwwroot +**/Localization/**/*.po + diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj b/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj index 7e925aa0..85343f8f 100644 --- a/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj @@ -14,6 +14,7 @@ + diff --git a/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj b/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj index 00f936c9..eee5bd6b 100644 --- a/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj +++ b/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj @@ -6,6 +6,10 @@ enable + + + + diff --git a/samples/OrchardCore/OrchardCore.Cms/Program.cs b/samples/OrchardCore/OrchardCore.Cms/Program.cs index 84699389..ed1bd8eb 100644 --- a/samples/OrchardCore/OrchardCore.Cms/Program.cs +++ b/samples/OrchardCore/OrchardCore.Cms/Program.cs @@ -1,10 +1,18 @@ var builder = WebApplication.CreateBuilder(args); builder.AddServiceDefaults(); + +builder.Services.AddOrchardCms(); + var app = builder.Build(); -app.MapDefaultEndpoints(); +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error"); + app.UseHsts(); +} -app.MapGet("/", () => "CMS App"); +app.UseStaticFiles(); +app.UseOrchardCore(); -app.Run(); +await app.RunAsync(); diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs new file mode 100644 index 00000000..dcd0e39e --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace HelloWorld.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs new file mode 100644 index 00000000..c69a903e --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs @@ -0,0 +1,5 @@ +using OrchardCore.Modules.Manifest; + +[assembly: Module( + Name = "Hello World" +)] diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj new file mode 100644 index 00000000..020b198a --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs new file mode 100644 index 00000000..bf176745 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs @@ -0,0 +1,10 @@ +var builder = WebApplication.CreateBuilder(args); + +builder.AddServiceDefaults(); +var app = builder.Build(); + +app.MapDefaultEndpoints(); + +app.MapGet("/", () => "Hello World!"); + +app.Run(); diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json new file mode 100644 index 00000000..8d5589dd --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:39812", + "sslPort": 44318 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5178", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7112;http://localhost:5178", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs new file mode 100644 index 00000000..7812e046 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs @@ -0,0 +1,16 @@ + +namespace OrchardCore.Mvc.HelloWorld; + +public class Startup : Modules.StartupBase +{ + public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) + { + routes.MapAreaControllerRoute + ( + name: "Home", + areaName: "OrchardCore.Mvc.HelloWorld", + pattern: string.Empty, + defaults: new { controller = "Home", action = "Index" } + ); + } +} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml new file mode 100644 index 00000000..7625d5e1 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml @@ -0,0 +1,5 @@ +

Hello World

+ + diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml new file mode 100644 index 00000000..a757b413 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml @@ -0,0 +1 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml new file mode 100644 index 00000000..2de62418 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj b/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj index 00f936c9..7d596963 100644 --- a/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj +++ b/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj @@ -6,8 +6,14 @@ enable + + + + + + diff --git a/samples/OrchardCore/OrchardCore.Mvc/Program.cs b/samples/OrchardCore/OrchardCore.Mvc/Program.cs index eb4a853a..49314453 100644 --- a/samples/OrchardCore/OrchardCore.Mvc/Program.cs +++ b/samples/OrchardCore/OrchardCore.Mvc/Program.cs @@ -1,10 +1,20 @@ var builder = WebApplication.CreateBuilder(args); builder.AddServiceDefaults(); + +builder.Services + .AddOrchardCore() + .AddMvc(); + var app = builder.Build(); -app.MapDefaultEndpoints(); +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error"); +} + +app.UseStaticFiles(); -app.MapGet("/", () => "MVC App"); +app.UseOrchardCore(); -app.Run(); +await app.RunAsync(); diff --git a/samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml b/samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..861f25c9 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml @@ -0,0 +1,24 @@ + + + + + + OrchardCore MVC App + + + + + + +
+ @RenderBody() +
+ + + @RenderSection("scripts", required: false) + + diff --git a/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml b/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml new file mode 100644 index 00000000..a757b413 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml @@ -0,0 +1 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml b/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml new file mode 100644 index 00000000..2de62418 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} diff --git a/samples/OrchardCore/OrchardCore.Mvc/appsettings.json b/samples/OrchardCore/OrchardCore.Mvc/appsettings.json index 10f68b8c..9c0b05b1 100644 --- a/samples/OrchardCore/OrchardCore.Mvc/appsettings.json +++ b/samples/OrchardCore/OrchardCore.Mvc/appsettings.json @@ -5,5 +5,6 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "Sample": "Sample Value" } diff --git a/samples/OrchardCore/OrchardCore.sln b/samples/OrchardCore/OrchardCore.sln index 50e9d67e..1656305e 100644 --- a/samples/OrchardCore/OrchardCore.sln +++ b/samples/OrchardCore/OrchardCore.sln @@ -11,6 +11,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Cms", "OrchardC EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Mvc", "OrchardCore.Mvc\OrchardCore.Mvc.csproj", "{54B7339E-AB80-4E01-B102-753A2420D695}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc", "Mvc", "{23861BF1-D68E-43F4-BC57-457051E326C9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{977106FF-F50C-44E3-916E-D99F7B9D5A23}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aspire", "Aspire", "{BC067F5D-BBC3-4159-9A65-F2B105BC0758}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cms", "Cms", "{D6EEA682-36AD-4F36-A81C-302DCB3004F7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Mvc.HelloWorld", "OrchardCore.Mvc.HelloWorld\OrchardCore.Mvc.HelloWorld.csproj", "{789378F1-5C72-4C5C-8153-9DDD7DB2C908}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,10 +43,22 @@ Global {54B7339E-AB80-4E01-B102-753A2420D695}.Debug|Any CPU.Build.0 = Debug|Any CPU {54B7339E-AB80-4E01-B102-753A2420D695}.Release|Any CPU.ActiveCfg = Release|Any CPU {54B7339E-AB80-4E01-B102-753A2420D695}.Release|Any CPU.Build.0 = Release|Any CPU + {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Debug|Any CPU.Build.0 = Debug|Any CPU + {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Release|Any CPU.ActiveCfg = Release|Any CPU + {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {402C833F-9FCE-4557-84D4-3AAAF74C8DE8} = {BC067F5D-BBC3-4159-9A65-F2B105BC0758} + {DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD} = {BC067F5D-BBC3-4159-9A65-F2B105BC0758} + {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692} = {D6EEA682-36AD-4F36-A81C-302DCB3004F7} + {54B7339E-AB80-4E01-B102-753A2420D695} = {23861BF1-D68E-43F4-BC57-457051E326C9} + {977106FF-F50C-44E3-916E-D99F7B9D5A23} = {23861BF1-D68E-43F4-BC57-457051E326C9} + {789378F1-5C72-4C5C-8153-9DDD7DB2C908} = {977106FF-F50C-44E3-916E-D99F7B9D5A23} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {77E10717-33F7-4C6D-94C3-9426C68D966C} EndGlobalSection diff --git a/samples/OrchardCore/README.md b/samples/OrchardCore/README.md new file mode 100644 index 00000000..5d98a03b --- /dev/null +++ b/samples/OrchardCore/README.md @@ -0,0 +1,51 @@ +--- +languages: +- csharp +products: +- dotnet +- dotnet-aspire +page_type: sample +name: ".NET Aspire OrchardCore sample app" +urlFragment: "aspire-orchard-core" +description: "A sample .NET Aspire app that shows how to use OrchardCore" +--- + +# .NET Aspire OrchardCore CMS and MVC sample app + +This is a simple .NET app that shows how to use OrchardCore with .NET Aspire orchestration. + +## Demonstrates + +- How to configure a .NET Aspire app to work with OrchardCore + +## Sample prerequisites + +- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) +- [Docker Desktop](https://www.docker.com/products/docker-desktop/) +- **Optional** [Visual Studio 2022 17.9 Preview](https://visualstudio.microsoft.com/vs/preview/) + + +## Running the sample + +To download and run the sample, follow these steps: + +### Run the project using Visual Studio + +To run the sample project using Visual Studio, open Visual Studio (2022 or later), then: + + 1. On the menu bar, choose **File** > **Open** > **Project/Solution**. + 2. Navigate to the folder that holds the unzipped sample code, and open the solution (.sln) file. + 3. Right click the _Aspire.AppHost_ project in the solution explore and choose it as the startup project. + 4. Choose the F5 key to run with debugging, or Ctrl+F5 keys to run the project without debugging. + +### Run the project using command line + +To run the .NET Aspire app, open a command line console and change directory to the OrchardCore solution folder. Then execute the following command: + +``` bash +dotnet run --project Aspire/Aspire.AppHost +``` + +On the **Projects** page, click on one of the endpoints (OrchardCore CMS or OrchardCore MVC) for the listed project. This launches the simple .NET app. + +For more information about using OrchardCore, see the [OrchardCore documentation](https://docs.orchardcore.net/en/latest/). From ba2384fa73fec7f39ca19e390f82dc8cc9c477af Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 4 Jan 2024 14:43:01 -0800 Subject: [PATCH 3/6] update read me --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 75fdadba..781186f2 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Sample highlights include: - [Integrating DAPR](./samples/AspireWithDapr) - [Persisting data in composed containers using volume mounts](./samples/VolumeMount) - [Working with database containers](./samples/DatabaseContainers) +- [Integrating OrchardCore CMS and MVC](./samples/OrchardCore) ## eShop From 4bd151981ff4b209fb614df03cb04b899a729a3a Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 4 Jan 2024 14:57:20 -0800 Subject: [PATCH 4/6] Update the .gitignore file --- samples/OrchardCore/.gitignore | 165 --------------------------------- 1 file changed, 165 deletions(-) diff --git a/samples/OrchardCore/.gitignore b/samples/OrchardCore/.gitignore index 65aefd5c..c20455c7 100644 --- a/samples/OrchardCore/.gitignore +++ b/samples/OrchardCore/.gitignore @@ -1,164 +1,3 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates -*.sln.ide/ - -# Build results - -[Dd]ebug/ -[Rr]elease/ -x64/ -build/ -app.publish/ -[Bb]in/ -[Oo]bj/ - -# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets -!packages/*/build/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.log -*.scc -project.lock.json - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# CodeRush personal settings -.cr/personal - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper - -# Rider is a IDE fm JetBrains -.idea - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.Publish.xml -*.pubxml - -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -packages/ - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -*.Cache -!OrchardCore.Environment.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.[Pp]ublish.xml -*.pfx -*.publishsettings - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -App_Data/*.mdf -App_Data/*.ldf - -# ========================= -# Windows detritus -# ========================= - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap -.DS_Store - # ========================= # Orchard specifics # ========================= @@ -166,12 +5,8 @@ $RECYCLE.BIN/ App_Data*/ .vs/ -#enable all /lib artifacts -!lib/*/*.* - #exclude node modules node_modules/ wwwroot **/Localization/**/*.po - From 69a5544bce9d36240d79ad4d7b509569f7cbe319 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 5 Jan 2024 09:37:36 -0800 Subject: [PATCH 5/6] Adding Postgres and remove the MVC sample --- Directory.Packages.props | 1 + README.md | 2 +- .../Aspire.AppHost/Aspire.AppHost.csproj | 2 - .../Aspire/Aspire.AppHost/Program.cs | 11 ++++-- .../OrchardCore/OrchardCore.Cms/NLog.config | 32 ++++++++++++++++ .../OrchardCore.Cms/OrchardCore.Cms.csproj | 1 + .../OrchardCore/OrchardCore.Cms/Program.cs | 5 ++- .../OrchardCore.Cms/appsettings.json | 14 ++++++- .../Controllers/HomeController.cs | 12 ------ .../OrchardCore.Mvc.HelloWorld/Manifest.cs | 5 --- .../OrchardCore.Mvc.HelloWorld.csproj | 17 --------- .../OrchardCore.Mvc.HelloWorld/Program.cs | 10 ----- .../Properties/launchSettings.json | 38 ------------------- .../OrchardCore.Mvc.HelloWorld/Startup.cs | 16 -------- .../Views/Home/Index.cshtml | 5 --- .../Views/_ViewImports.cshtml | 1 - .../Views/_ViewStart.cshtml | 3 -- .../appsettings.Development.json | 8 ---- .../appsettings.json | 9 ----- .../OrchardCore.Mvc/OrchardCore.Mvc.csproj | 19 ---------- .../OrchardCore/OrchardCore.Mvc/Program.cs | 20 ---------- .../Properties/launchSettings.json | 38 ------------------- .../Views/Shared/_Layout.cshtml | 24 ------------ .../OrchardCore.Mvc/Views/_ViewImports.cshtml | 1 - .../OrchardCore.Mvc/Views/_ViewStart.cshtml | 3 -- .../appsettings.Development.json | 8 ---- .../OrchardCore.Mvc/appsettings.json | 10 ----- samples/OrchardCore/OrchardCore.sln | 22 ----------- samples/OrchardCore/README.md | 4 +- 29 files changed, 61 insertions(+), 280 deletions(-) create mode 100644 samples/OrchardCore/OrchardCore.Cms/NLog.config delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json delete mode 100644 samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/Program.cs delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json delete mode 100644 samples/OrchardCore/OrchardCore.Mvc/appsettings.json diff --git a/Directory.Packages.props b/Directory.Packages.props index 96ac9cf5..70fe11ec 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -66,6 +66,7 @@ + diff --git a/README.md b/README.md index 781186f2..06e92790 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Sample highlights include: - [Integrating DAPR](./samples/AspireWithDapr) - [Persisting data in composed containers using volume mounts](./samples/VolumeMount) - [Working with database containers](./samples/DatabaseContainers) -- [Integrating OrchardCore CMS and MVC](./samples/OrchardCore) +- [Integrating OrchardCore CMS](./samples/OrchardCore) ## eShop diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj b/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj index 85343f8f..5bf1b8c9 100644 --- a/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Aspire.AppHost.csproj @@ -14,8 +14,6 @@ - - diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs b/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs index 1b81328b..fb0104fa 100644 --- a/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs @@ -1,10 +1,13 @@ var builder = DistributedApplication.CreateBuilder(args); +var cmsdb = builder.AddPostgresContainer("Postgres", 62262, "OrchardCorePass") + .WithEnvironment("POSTGRES_USER", "occms") + .WithEnvironment("POSTGRES_PASSWORD", "OrchardCorePass"); + var redis = builder.AddRedisContainer("Redis", 50963); builder.AddProject("OrchardCore CMS") - .WithReference(redis); + .WithReference(redis) + .WithReference(cmsdb); -builder.AddProject("OrchardCore MVC"); - -builder.Build().Run(); +await builder.Build().RunAsync(); diff --git a/samples/OrchardCore/OrchardCore.Cms/NLog.config b/samples/OrchardCore/OrchardCore.Cms/NLog.config new file mode 100644 index 00000000..772f22d4 --- /dev/null +++ b/samples/OrchardCore/OrchardCore.Cms/NLog.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj b/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj index eee5bd6b..bd5a1f60 100644 --- a/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj +++ b/samples/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj @@ -8,6 +8,7 @@ + diff --git a/samples/OrchardCore/OrchardCore.Cms/Program.cs b/samples/OrchardCore/OrchardCore.Cms/Program.cs index ed1bd8eb..71482a2a 100644 --- a/samples/OrchardCore/OrchardCore.Cms/Program.cs +++ b/samples/OrchardCore/OrchardCore.Cms/Program.cs @@ -1,5 +1,8 @@ -var builder = WebApplication.CreateBuilder(args); +using OrchardCore.Logging; +var builder = WebApplication.CreateBuilder(args); + +builder.Host.UseNLogHost(); builder.AddServiceDefaults(); builder.Services.AddOrchardCms(); diff --git a/samples/OrchardCore/OrchardCore.Cms/appsettings.json b/samples/OrchardCore/OrchardCore.Cms/appsettings.json index 10f68b8c..76a60c60 100644 --- a/samples/OrchardCore/OrchardCore.Cms/appsettings.json +++ b/samples/OrchardCore/OrchardCore.Cms/appsettings.json @@ -5,5 +5,17 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "OrchardCore": { + "Default": { + "State": "Uninitialized", + "TablePrefix": "Default" + }, + "ConnectionString": "host=localhost;port=62262;database=occms;username=occms;password=OrchardCorePass", + "DatabaseProvider": "Postgres", + "OrchardCore_Redis": { + "Configuration": "localhost:50963,allowAdmin=true", + "InstancePrefix": "" + } + } } diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs deleted file mode 100644 index dcd0e39e..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace HelloWorld.Controllers -{ - public class HomeController : Controller - { - public IActionResult Index() - { - return View(); - } - } -} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs deleted file mode 100644 index c69a903e..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Manifest.cs +++ /dev/null @@ -1,5 +0,0 @@ -using OrchardCore.Modules.Manifest; - -[assembly: Module( - Name = "Hello World" -)] diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj deleted file mode 100644 index 020b198a..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/OrchardCore.Mvc.HelloWorld.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - - diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs deleted file mode 100644 index bf176745..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Program.cs +++ /dev/null @@ -1,10 +0,0 @@ -var builder = WebApplication.CreateBuilder(args); - -builder.AddServiceDefaults(); -var app = builder.Build(); - -app.MapDefaultEndpoints(); - -app.MapGet("/", () => "Hello World!"); - -app.Run(); diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json deleted file mode 100644 index 8d5589dd..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Properties/launchSettings.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:39812", - "sslPort": 44318 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "http://localhost:5178", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:7112;http://localhost:5178", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs deleted file mode 100644 index 7812e046..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Startup.cs +++ /dev/null @@ -1,16 +0,0 @@ - -namespace OrchardCore.Mvc.HelloWorld; - -public class Startup : Modules.StartupBase -{ - public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) - { - routes.MapAreaControllerRoute - ( - name: "Home", - areaName: "OrchardCore.Mvc.HelloWorld", - pattern: string.Empty, - defaults: new { controller = "Home", action = "Index" } - ); - } -} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml deleted file mode 100644 index 7625d5e1..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/Home/Index.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -

Hello World

- - diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml deleted file mode 100644 index a757b413..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewImports.cshtml +++ /dev/null @@ -1 +0,0 @@ -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml deleted file mode 100644 index 2de62418..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/Views/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "~/Views/Shared/_Layout.cshtml"; -} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json deleted file mode 100644 index 0c208ae9..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json b/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json deleted file mode 100644 index 10f68b8c..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc.HelloWorld/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj b/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj deleted file mode 100644 index 7d596963..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/OrchardCore.Mvc.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - - - - diff --git a/samples/OrchardCore/OrchardCore.Mvc/Program.cs b/samples/OrchardCore/OrchardCore.Mvc/Program.cs deleted file mode 100644 index 49314453..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -var builder = WebApplication.CreateBuilder(args); - -builder.AddServiceDefaults(); - -builder.Services - .AddOrchardCore() - .AddMvc(); - -var app = builder.Build(); - -if (!app.Environment.IsDevelopment()) -{ - app.UseExceptionHandler("/Error"); -} - -app.UseStaticFiles(); - -app.UseOrchardCore(); - -await app.RunAsync(); diff --git a/samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json b/samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json deleted file mode 100644 index ddbbcaaa..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/Properties/launchSettings.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:46492", - "sslPort": 44382 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "http://localhost:5175", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:7025;http://localhost:5175", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml b/samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml deleted file mode 100644 index 861f25c9..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - OrchardCore MVC App - - - - - - -
- @RenderBody() -
- - - @RenderSection("scripts", required: false) - - diff --git a/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml b/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml deleted file mode 100644 index a757b413..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewImports.cshtml +++ /dev/null @@ -1 +0,0 @@ -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml b/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml deleted file mode 100644 index 2de62418..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/Views/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "~/Views/Shared/_Layout.cshtml"; -} diff --git a/samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json b/samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json deleted file mode 100644 index 0c208ae9..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/samples/OrchardCore/OrchardCore.Mvc/appsettings.json b/samples/OrchardCore/OrchardCore.Mvc/appsettings.json deleted file mode 100644 index 9c0b05b1..00000000 --- a/samples/OrchardCore/OrchardCore.Mvc/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "Sample": "Sample Value" -} diff --git a/samples/OrchardCore/OrchardCore.sln b/samples/OrchardCore/OrchardCore.sln index 1656305e..ab79c0bd 100644 --- a/samples/OrchardCore/OrchardCore.sln +++ b/samples/OrchardCore/OrchardCore.sln @@ -9,18 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.ServiceDefaults", "A EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Cms", "OrchardCore.Cms\OrchardCore.Cms.csproj", "{58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Mvc", "OrchardCore.Mvc\OrchardCore.Mvc.csproj", "{54B7339E-AB80-4E01-B102-753A2420D695}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc", "Mvc", "{23861BF1-D68E-43F4-BC57-457051E326C9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{977106FF-F50C-44E3-916E-D99F7B9D5A23}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aspire", "Aspire", "{BC067F5D-BBC3-4159-9A65-F2B105BC0758}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cms", "Cms", "{D6EEA682-36AD-4F36-A81C-302DCB3004F7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Mvc.HelloWorld", "OrchardCore.Mvc.HelloWorld\OrchardCore.Mvc.HelloWorld.csproj", "{789378F1-5C72-4C5C-8153-9DDD7DB2C908}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,14 +29,6 @@ Global {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Debug|Any CPU.Build.0 = Debug|Any CPU {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Release|Any CPU.ActiveCfg = Release|Any CPU {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692}.Release|Any CPU.Build.0 = Release|Any CPU - {54B7339E-AB80-4E01-B102-753A2420D695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {54B7339E-AB80-4E01-B102-753A2420D695}.Debug|Any CPU.Build.0 = Debug|Any CPU - {54B7339E-AB80-4E01-B102-753A2420D695}.Release|Any CPU.ActiveCfg = Release|Any CPU - {54B7339E-AB80-4E01-B102-753A2420D695}.Release|Any CPU.Build.0 = Release|Any CPU - {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Debug|Any CPU.Build.0 = Debug|Any CPU - {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Release|Any CPU.ActiveCfg = Release|Any CPU - {789378F1-5C72-4C5C-8153-9DDD7DB2C908}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -54,10 +36,6 @@ Global GlobalSection(NestedProjects) = preSolution {402C833F-9FCE-4557-84D4-3AAAF74C8DE8} = {BC067F5D-BBC3-4159-9A65-F2B105BC0758} {DE2BA7D5-D4FE-446E-AED3-771C7BDF5CAD} = {BC067F5D-BBC3-4159-9A65-F2B105BC0758} - {58DC94EA-7B87-4FA9-B3D1-E20AD89E5692} = {D6EEA682-36AD-4F36-A81C-302DCB3004F7} - {54B7339E-AB80-4E01-B102-753A2420D695} = {23861BF1-D68E-43F4-BC57-457051E326C9} - {977106FF-F50C-44E3-916E-D99F7B9D5A23} = {23861BF1-D68E-43F4-BC57-457051E326C9} - {789378F1-5C72-4C5C-8153-9DDD7DB2C908} = {977106FF-F50C-44E3-916E-D99F7B9D5A23} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {77E10717-33F7-4C6D-94C3-9426C68D966C} diff --git a/samples/OrchardCore/README.md b/samples/OrchardCore/README.md index 5d98a03b..c3dd7eda 100644 --- a/samples/OrchardCore/README.md +++ b/samples/OrchardCore/README.md @@ -10,7 +10,7 @@ urlFragment: "aspire-orchard-core" description: "A sample .NET Aspire app that shows how to use OrchardCore" --- -# .NET Aspire OrchardCore CMS and MVC sample app +# .NET Aspire OrchardCore CMS sample app This is a simple .NET app that shows how to use OrchardCore with .NET Aspire orchestration. @@ -46,6 +46,6 @@ To run the .NET Aspire app, open a command line console and change directory to dotnet run --project Aspire/Aspire.AppHost ``` -On the **Projects** page, click on one of the endpoints (OrchardCore CMS or OrchardCore MVC) for the listed project. This launches the simple .NET app. +On the **Projects** page, click on one of the endpoints (OrchardCore CMS) for the listed project. This launches the simple .NET app. For more information about using OrchardCore, see the [OrchardCore documentation](https://docs.orchardcore.net/en/latest/). From ff02926e61c59c2f99c57536a984073470be6136 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 5 Jan 2024 09:59:20 -0800 Subject: [PATCH 6/6] use enviornment variables --- samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs | 11 ++++++++--- samples/OrchardCore/OrchardCore.Cms/appsettings.json | 11 +---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs b/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs index fb0104fa..7049023e 100644 --- a/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs +++ b/samples/OrchardCore/Aspire/Aspire.AppHost/Program.cs @@ -1,12 +1,17 @@ var builder = DistributedApplication.CreateBuilder(args); +const int postgresPort = 62262; +const string postgresUsername = "occms"; +const string postgresPassword = "OrchardCorePass"; -var cmsdb = builder.AddPostgresContainer("Postgres", 62262, "OrchardCorePass") - .WithEnvironment("POSTGRES_USER", "occms") - .WithEnvironment("POSTGRES_PASSWORD", "OrchardCorePass"); +var cmsdb = builder.AddPostgresContainer("Postgres", postgresPort, postgresPassword); var redis = builder.AddRedisContainer("Redis", 50963); builder.AddProject("OrchardCore CMS") + .WithEnvironment("OrchardCore__Default__State", "Uninitialized") + .WithEnvironment("OrchardCore__Default__TablePrefix", "Default") + .WithEnvironment("OrchardCore__DatabaseProvider", "Postgres") + .WithEnvironment("OrchardCore__ConnectionString", $"host=localhost;port={postgresPort};database={postgresUsername};username={postgresUsername};password={postgresPassword}") .WithReference(redis) .WithReference(cmsdb); diff --git a/samples/OrchardCore/OrchardCore.Cms/appsettings.json b/samples/OrchardCore/OrchardCore.Cms/appsettings.json index 76a60c60..5a26a881 100644 --- a/samples/OrchardCore/OrchardCore.Cms/appsettings.json +++ b/samples/OrchardCore/OrchardCore.Cms/appsettings.json @@ -7,15 +7,6 @@ }, "AllowedHosts": "*", "OrchardCore": { - "Default": { - "State": "Uninitialized", - "TablePrefix": "Default" - }, - "ConnectionString": "host=localhost;port=62262;database=occms;username=occms;password=OrchardCorePass", - "DatabaseProvider": "Postgres", - "OrchardCore_Redis": { - "Configuration": "localhost:50963,allowAdmin=true", - "InstancePrefix": "" - } + } }