Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup .NET Core
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json

Expand Down
127 changes: 123 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from `dotnet new gitignore`

.idea
# dotenv files
.env

# User-specific files
*.rsuser
Expand Down Expand Up @@ -31,7 +32,6 @@ x86/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/

Expand Down Expand Up @@ -60,11 +60,14 @@ dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
# .NET
project.lock.json
project.fragment.lock.json
artifacts/

# Tye
.tye/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

Expand Down Expand Up @@ -93,6 +96,7 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -296,6 +300,17 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -352,6 +367,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand All @@ -364,6 +382,107 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
*.sln.iml
.idea/

##
## Visual studio for Mac
##


# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/

# Mac bundle stuff
*.dmg
*.app

# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# Vim temporary swap files
*.swp

# Added by me
logs
LocalFileStorage
Expand Down
1 change: 1 addition & 0 deletions SharedKernel.Demo/MessageHub.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.SignalR;
using ResponseCrafter.ExceptionHandlers.SignalR;
using System.Threading;

namespace SharedKernel.Demo;

Expand Down
8 changes: 4 additions & 4 deletions SharedKernel.Demo/SharedKernel.Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="9.0.0"/>
<PackageReference Include="MassTransit.RabbitMQ" Version="8.5.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.8"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.8"/>
<PackageReference Include="MassTransit.RabbitMQ" Version="8.5.7" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
46 changes: 0 additions & 46 deletions SharedKernel.sln

This file was deleted.

16 changes: 16 additions & 0 deletions SharedKernel.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path=".github/workflows/main.yml" />
<File Path=".gitignore" />
<File Path="global.json" />
<File Path="Readme.md" />
</Folder>
<Folder Name="/src/">
<Project Path="src/SharedKernel/SharedKernel.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="SharedKernel.Demo/SharedKernel.Demo.csproj" />
<Project Path="test/SharedKernel.Tests/SharedKernel.Tests.csproj" />
</Folder>
</Solution>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.200",
"version": "10.0.101",
"rollForward": "latestMinor"
}
}
43 changes: 13 additions & 30 deletions src/SharedKernel/Extensions/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,30 @@ internal static class ConfigurationExtensions
private const string RepositoryNameConfigurationPath = "RepositoryName";
private const string TimeZoneConfigurationPath = "DefaultTimeZone";

internal static string GetAllowedCorsOrigins(this IConfiguration configuration)
extension(IConfiguration configuration)
{
var corsOrigins = configuration[CorsOriginsConfigurationPath];
if (corsOrigins is null)
internal string GetAllowedCorsOrigins()
{
throw new InvalidOperationException("Allowed CORS origins are not configured.");
var corsOrigins = configuration[CorsOriginsConfigurationPath];
return corsOrigins ?? throw new InvalidOperationException("Allowed CORS origins are not configured.");
}

return corsOrigins;
}

internal static string GetRepositoryName(this IConfiguration configuration)
{
var repositoryName = configuration[RepositoryNameConfigurationPath];
if (repositoryName is null)
internal string GetRepositoryName()
{
throw new InvalidOperationException("Repository name is not configured.");
var repositoryName = configuration[RepositoryNameConfigurationPath];
return repositoryName ?? throw new InvalidOperationException("Repository name is not configured.");
}

return repositoryName;
}

internal static string GetPersistentPath(this IConfiguration configuration)
{
var persistentPath = configuration.GetConnectionString(PersistentConfigurationPath);
if (persistentPath is null)
internal string GetPersistentPath()
{
throw new InvalidOperationException("Persistent path is not configured.");
var persistentPath = configuration.GetConnectionString(PersistentConfigurationPath);
return persistentPath ?? throw new InvalidOperationException("Persistent path is not configured.");
}

return persistentPath;
}

public static string GetDefaultTimeZone(this IConfiguration configuration)
{
var timeZone = configuration[TimeZoneConfigurationPath];
if (timeZone is null)
public string GetDefaultTimeZone()
{
throw new InvalidOperationException("Default time zone is not configured.");
var timeZone = configuration[TimeZoneConfigurationPath];
return timeZone ?? throw new InvalidOperationException("Default time zone is not configured.");
}

return timeZone;
}
}
3 changes: 1 addition & 2 deletions src/SharedKernel/Extensions/HealthCheckExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public static WebApplication MapHealthCheckEndpoints(this WebApplication app)
app
.MapGet($"{EndpointConstants.BasePath}/ping", () => "pong")
.Produces<string>()
.WithTags(EndpointConstants.TagName)
.WithOpenApi();
.WithTags(EndpointConstants.TagName);

app.MapHealthChecks($"{EndpointConstants.BasePath}/health",
new HealthCheckOptions
Expand Down
Loading