Initial commit

This commit is contained in:
Holden
2026-06-17 22:27:12 -05:00
commit c7b8857208
35 changed files with 565 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/

15
.idea/.idea.RecNet/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/contentModel.xml
/.idea.RecNet.iml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

1
.idea/.idea.RecNet/.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
RecNet

4
.idea/.idea.RecNet/.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
.idea/.idea.RecNet/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

13
API/API.csproj Normal file
View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.8"/>
</ItemGroup>
</Project>

6
API/API.http Normal file
View File

@@ -0,0 +1,6 @@
@API_HostAddress = http://localhost:5155
GET {{API_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries =
[
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
];
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}

32
API/Program.cs Normal file
View File

@@ -0,0 +1,32 @@
namespace API;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}

View File

@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5155",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7218;http://localhost:5155",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

12
API/WeatherForecast.cs Normal file
View File

@@ -0,0 +1,12 @@
namespace API;
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

9
API/appsettings.json Normal file
View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

8
AppHost/AppHost.cs Normal file
View File

@@ -0,0 +1,8 @@
using Aspire.Hosting;
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres");
var db = postgres.AddDatabase("recnet");
builder.Build().Run();

15
AppHost/AppHost.csproj Normal file
View File

@@ -0,0 +1,15 @@
<Project Sdk="Aspire.AppHost.Sdk/13.4.5">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>f7385039-092b-4272-a61a-69c6a3d0d618</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="13.4.5" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17063;http://localhost:15151",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21097",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22143"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15151",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19205",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20044"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

9
AppHost/appsettings.json Normal file
View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}

View File

@@ -0,0 +1,5 @@
{
"appHost": {
"path": "AppHost.csproj"
}
}

View File

@@ -0,0 +1,5 @@
namespace RecNet.Application;
public class Class1
{
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

5
RecNet.Domain/Class1.cs Normal file
View File

@@ -0,0 +1,5 @@
namespace RecNet.Domain;
public class Class1
{
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
using Microsoft.EntityFrameworkCore;
namespace RecNet.Infrastructure.Persistence;
public class DatabaseContext : DbContext
{
}

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="13.4.5" />
</ItemGroup>
<ItemGroup>
<Folder Include="Persistence\Configurations\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
using RecNet.MigrationService;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
host.Run();

View File

@@ -0,0 +1,12 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"RecNet.MigrationService": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-RecNet.MigrationService-78833cdb-5790-420f-94d2-bec6860bfe4c</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.8"/>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,17 @@
namespace RecNet.MigrationService;
public class Worker(ILogger<Worker> logger) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
if (logger.IsEnabled(LogLevel.Information))
{
logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
}
await Task.Delay(1000, stoppingToken);
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@@ -0,0 +1,130 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ServiceDiscovery;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
namespace Microsoft.Extensions.Hosting;
// Adds common Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
// This project should be referenced by each service project in your solution.
// To learn more about using this project, see https://aka.ms/aspire/service-defaults
public static class Extensions
{
private const string HealthEndpointPath = "/health";
private const string AlivenessEndpointPath = "/alive";
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
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.AddServiceDiscovery();
});
// Uncomment the following to restrict the allowed schemes for service discovery.
// builder.Services.Configure<ServiceDiscoveryOptions>(options =>
// {
// options.AllowedSchemes = ["https"];
// });
return builder;
}
public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder)
where TBuilder : IHostApplicationBuilder
{
builder.Logging.AddOpenTelemetry(logging =>
{
logging.IncludeFormattedMessage = true;
logging.IncludeScopes = true;
});
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
tracing.AddSource(builder.Environment.ApplicationName)
.AddAspNetCoreInstrumentation(tracing =>
// Exclude health check requests from tracing
tracing.Filter = context =>
!context.Request.Path.StartsWithSegments(HealthEndpointPath)
&& !context.Request.Path.StartsWithSegments(AlivenessEndpointPath)
)
// Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
//.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation();
});
builder.AddOpenTelemetryExporters();
return builder;
}
private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builder)
where TBuilder : IHostApplicationBuilder
{
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
if (useOtlpExporter)
{
builder.Services.AddOpenTelemetry().UseOtlpExporter();
}
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
//{
// builder.Services.AddOpenTelemetry()
// .UseAzureMonitor();
//}
return builder;
}
public static TBuilder AddDefaultHealthChecks<TBuilder>(this TBuilder builder)
where TBuilder : IHostApplicationBuilder
{
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)
{
// Adding health checks endpoints to applications in non-development environments has security implications.
// See https://aka.ms/aspire/healthchecks for details before enabling these endpoints in non-development environments.
if (app.Environment.IsDevelopment())
{
// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks(HealthEndpointPath);
// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks(AlivenessEndpointPath, new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
}
return app;
}
}

View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.6.0"/>
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="10.6.0"/>
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3"/>
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.3"/>
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.2"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.1"/>
</ItemGroup>
</Project>

54
RecNet.sln Normal file
View File

@@ -0,0 +1,54 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecNet.ServiceDefaults", "RecNet.ServiceDefaults\RecNet.ServiceDefaults.csproj", "{7773AA04-37C6-4E72-98AB-A239ED268ECC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppHost", "AppHost\AppHost.csproj", "{F539C6BB-F396-41CC-B275-DF8CC3B8CA2F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "API", "API\API.csproj", "{CD6E60F3-675A-4F51-8645-9CA6B35C1032}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecNet.Infrastructure", "RecNet.Infrastructure\RecNet.Infrastructure.csproj", "{E61153A9-DAD9-4ED3-A8A5-8F619BBE54D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecNet.Domain", "RecNet.Domain\RecNet.Domain.csproj", "{4E9D18A6-BC68-49BE-81FE-03B74270485D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecNet.Application", "RecNet.Application\RecNet.Application.csproj", "{BF255F63-3A85-4AD4-AB13-1C1C1C1724ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecNet.MigrationService", "RecNet.MigrationService\RecNet.MigrationService.csproj", "{2343DEEB-8CBA-4B0A-BE67-3F8F76E6E7C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7773AA04-37C6-4E72-98AB-A239ED268ECC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7773AA04-37C6-4E72-98AB-A239ED268ECC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7773AA04-37C6-4E72-98AB-A239ED268ECC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7773AA04-37C6-4E72-98AB-A239ED268ECC}.Release|Any CPU.Build.0 = Release|Any CPU
{F539C6BB-F396-41CC-B275-DF8CC3B8CA2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F539C6BB-F396-41CC-B275-DF8CC3B8CA2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F539C6BB-F396-41CC-B275-DF8CC3B8CA2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F539C6BB-F396-41CC-B275-DF8CC3B8CA2F}.Release|Any CPU.Build.0 = Release|Any CPU
{CD6E60F3-675A-4F51-8645-9CA6B35C1032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD6E60F3-675A-4F51-8645-9CA6B35C1032}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD6E60F3-675A-4F51-8645-9CA6B35C1032}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD6E60F3-675A-4F51-8645-9CA6B35C1032}.Release|Any CPU.Build.0 = Release|Any CPU
{E61153A9-DAD9-4ED3-A8A5-8F619BBE54D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E61153A9-DAD9-4ED3-A8A5-8F619BBE54D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E61153A9-DAD9-4ED3-A8A5-8F619BBE54D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E61153A9-DAD9-4ED3-A8A5-8F619BBE54D4}.Release|Any CPU.Build.0 = Release|Any CPU
{4E9D18A6-BC68-49BE-81FE-03B74270485D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E9D18A6-BC68-49BE-81FE-03B74270485D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E9D18A6-BC68-49BE-81FE-03B74270485D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E9D18A6-BC68-49BE-81FE-03B74270485D}.Release|Any CPU.Build.0 = Release|Any CPU
{BF255F63-3A85-4AD4-AB13-1C1C1C1724ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF255F63-3A85-4AD4-AB13-1C1C1C1724ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF255F63-3A85-4AD4-AB13-1C1C1C1724ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF255F63-3A85-4AD4-AB13-1C1C1C1724ED}.Release|Any CPU.Build.0 = Release|Any CPU
{2343DEEB-8CBA-4B0A-BE67-3F8F76E6E7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2343DEEB-8CBA-4B0A-BE67-3F8F76E6E7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2343DEEB-8CBA-4B0A-BE67-3F8F76E6E7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2343DEEB-8CBA-4B0A-BE67-3F8F76E6E7C1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
EndGlobal