Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkey committed Dec 14, 2023
2 parents 675955e + 03902e2 commit 45c225a
Show file tree
Hide file tree
Showing 565 changed files with 6,865 additions and 5,252 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -54,7 +54,17 @@ jobs:
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore CleanArchitecture.Blazor.sln

- name: Build
run: dotnet build CleanArchitecture.Blazor.sln --configuration Debug --no-restore

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore CleanArchitecture.Blazor.sln
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,4 @@ MigrationBackup/


**/Files/
src/Blazor.Server.UI/appsettings.development.json
src/Server.UI/appsettings.development.json
2 changes: 1 addition & 1 deletion .template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"*.nupkg",
"launchSettings.json",
"*.exe",
"src/Blazor.Server.UI/Files/**"
"src/Server.UI/Files/**"
]
}
]
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Blazor.Server.UI/bin/Debug/net6.0/Blazor.Server.UI.dll",
"program": "${workspaceFolder}/src/Server.UI/bin/Debug/net6.0/CleanArchitecture.Blazor.Server.UI.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Blazor.Server.UI",
"cwd": "${workspaceFolder}/src/Server.UI",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
Expand Down
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/Blazor.Server.UI/Blazor.Server.UI.csproj",
"${workspaceFolder}/src/Server.UI/Server.UI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/Blazor.Server.UI/Blazor.Server.UI.csproj",
"${workspaceFolder}/src/Server.UI/Server.UI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/src/Blazor.Server.UI/Blazor.Server.UI.csproj"
"${workspaceFolder}/src/Server.UI/Server.UI.csproj"
],
"problemMatcher": "$msCompile"
}
Expand Down
9 changes: 4 additions & 5 deletions CleanArchitecture.Blazor.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>CleanArchitecture.Blazor.Solution.Template</id>
<version>1.0.0-preview.16</version>
<version>1.0.0-preview.17</version>
<title>Clean Architecture Blazor Solution Template</title>
<authors>hl.z</authors>
<description>Clean Architecture Blazor Solution Template for .NET 7.</description>
<description>Clean Architecture Blazor Solution Template for .NET 8.</description>
<summary>
A Clean Architecture Blazor Server Solution Template for creating a Single-Page Application (SPA) with ASP.NET Core.
</summary>
<releaseNotes>
1.0.0-preview.16
- ✨ refactoring code for DialogParameters
- ✨ add UseSnakeCaseNamingConvention for Npgsql
1.0.0-preview.17
- 🌈 support.net 8
</releaseNotes>

<projectUrl>https://github.com/neozhu/CleanArchitectureWithBlazorServer</projectUrl>
Expand Down
21 changes: 14 additions & 7 deletions CleanArchitecture.Blazor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "src\Domain\Domain
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{D5A42BE7-D229-4746-9D2A-AC878F79DBED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Server.UI", "src\Blazor.Server.UI\Blazor.Server.UI.csproj", "{66AFF428-DE0D-4F7A-B5D4-B321DE267A15}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{6BD2EC46-FA8F-44F3-AF33-903BBB347116}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application.IntegrationTests", "tests\Application.IntegrationTests\Application.IntegrationTests.csproj", "{4AF55920-007C-411D-8AD3-6F9D2C722450}"
Expand All @@ -40,6 +38,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrators.PostgreSQL", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrators.SqLite", "src\Migrators\Migrators.SqLite\Migrators.SqLite.csproj", "{469D68F1-379E-46A6-AAC3-CD1E4C0E7D77}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.UI", "src\Server.UI\Server.UI.csproj", "{3E4AF4E5-02EE-4F26-9B6D-8723670172B3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "src\Server\Server.csproj", "{E5008BA6-6358-413C-A082-AF14115EF18B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -58,10 +60,6 @@ Global
{D5A42BE7-D229-4746-9D2A-AC878F79DBED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5A42BE7-D229-4746-9D2A-AC878F79DBED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5A42BE7-D229-4746-9D2A-AC878F79DBED}.Release|Any CPU.Build.0 = Release|Any CPU
{66AFF428-DE0D-4F7A-B5D4-B321DE267A15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66AFF428-DE0D-4F7A-B5D4-B321DE267A15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66AFF428-DE0D-4F7A-B5D4-B321DE267A15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66AFF428-DE0D-4F7A-B5D4-B321DE267A15}.Release|Any CPU.Build.0 = Release|Any CPU
{6BD2EC46-FA8F-44F3-AF33-903BBB347116}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BD2EC46-FA8F-44F3-AF33-903BBB347116}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BD2EC46-FA8F-44F3-AF33-903BBB347116}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -90,6 +88,14 @@ Global
{469D68F1-379E-46A6-AAC3-CD1E4C0E7D77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{469D68F1-379E-46A6-AAC3-CD1E4C0E7D77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{469D68F1-379E-46A6-AAC3-CD1E4C0E7D77}.Release|Any CPU.Build.0 = Release|Any CPU
{3E4AF4E5-02EE-4F26-9B6D-8723670172B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E4AF4E5-02EE-4F26-9B6D-8723670172B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E4AF4E5-02EE-4F26-9B6D-8723670172B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E4AF4E5-02EE-4F26-9B6D-8723670172B3}.Release|Any CPU.Build.0 = Release|Any CPU
{E5008BA6-6358-413C-A082-AF14115EF18B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5008BA6-6358-413C-A082-AF14115EF18B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5008BA6-6358-413C-A082-AF14115EF18B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5008BA6-6358-413C-A082-AF14115EF18B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -98,14 +104,15 @@ Global
{196FC2C6-2817-494B-AB9D-26F9DD33247A} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
{AAD8A88D-2BBE-4C6E-A4CA-02D9005BF3DF} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
{D5A42BE7-D229-4746-9D2A-AC878F79DBED} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
{66AFF428-DE0D-4F7A-B5D4-B321DE267A15} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
{4AF55920-007C-411D-8AD3-6F9D2C722450} = {E5DE00AF-3C91-41CE-B37C-2C46F97739F3}
{92C7B430-4830-4ECB-B195-7AA306F1ED21} = {E5DE00AF-3C91-41CE-B37C-2C46F97739F3}
{CA0BF3A4-392B-41AC-AAEF-C83A59913499} = {E5DE00AF-3C91-41CE-B37C-2C46F97739F3}
{5C45543E-B3FA-4C1F-9D7D-DA2E6654BD61} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
{910C5689-CC8A-4E5B-8894-B00515C90466} = {5C45543E-B3FA-4C1F-9D7D-DA2E6654BD61}
{08778353-0814-41BB-B49E-36BBA8D7751D} = {5C45543E-B3FA-4C1F-9D7D-DA2E6654BD61}
{469D68F1-379E-46A6-AAC3-CD1E4C0E7D77} = {5C45543E-B3FA-4C1F-9D7D-DA2E6654BD61}
{3E4AF4E5-02EE-4F26-9B6D-8723670172B3} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
{E5008BA6-6358-413C-A082-AF14115EF18B} = {21DC0B96-ED87-4130-BA8D-E8CF73903344}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {384CDE06-46A5-4FC5-AED4-7B23339EA56F}
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Blazor technology.

- Microsoft Visual Studio Community 2022 (64-bit)
- Docker
- .NET 7.0
- .NET 8.0
- Unit Test

![image](https://user-images.githubusercontent.com/1549611/183799080-380e1f01-ef80-4568-80d2-517514aa59e5.png)
Expand All @@ -34,18 +34,18 @@ Blazor technology.

### How to select a specific Database?

1. Open the `appsettings.json` file located in the src directory of the `Blazor.Server.UI` project.
1. Open the `appsettings.json` file located in the src directory of the `Server.UI` project.
2. Change the setting `DBProvider` to the desired provider name (See Supported Databases).
3. Change the `ConnectionString` to a connection string, which works for your selected database provider.

## Docker compose https deployment

- Create self-signed development certificates for the project
- cmd: `dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\Blazor.Server.UI.pfx -p Password@123`
- cmd: `dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\CleanArchitecture.Blazor.Server.UI.pfx -p Password@123`
- cmd: `dotnet dev-certs https --trust`
- Manage User secrets to save the password
- cmd: `dotnet user-secrets init`
- cmd: `dotnet user-secrets -p Blazor.Server.UI.csproj set "Kestrel:Certificates:Development:Password" "Password@123"`
- cmd: `dotnet user-secrets -p Server.UI.csproj set "Kestrel:Certificates:Development:Password" "Password@123"`

## Code Generator Extension for visual studio.net 2022

Expand Down
11 changes: 0 additions & 11 deletions docker-compose.dcproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,11 @@
<None Include="docker-compose.yml" />
<None Include="docker-compose.override.yml" />
<None Include=".dockerignore" />
<None Include="src\Blazor.Server.UI\Pages\Identity\Users\Users.razor.cs" />
<None Include="src\Blazor.Server.UI\Shared\UserLoginState.razor.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="launchSettings.json" />
</ItemGroup>
<ItemGroup>
<None Remove="launchSettings.json" />
</ItemGroup>
<ItemGroup>
<None Remove="launchSettings.json" />
</ItemGroup>
<ItemGroup>
<None Remove="src\**" />
</ItemGroup>
<ItemGroup>
<None Include="src\Blazor.Server.UI\Pages\Identity\Users\Profile.razor.cs" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ services:
image: ${DOCKER_REGISTRY-}blazorserver
build:
context: .
dockerfile: src/Blazor.Server.UI/Dockerfile
dockerfile: src/Server.UI/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Development
- UseInMemoryDatabase=true
- ConnectionStrings__DefaultConnection=Server=sqldb;Database=BlazorDashboardDb;User=sa;Password=Password@123;MultipleActiveResultSets=true
- ASPNETCORE_URLS=https://+:443;http://+:80
#- ASPNETCORE_Kestrel__Certificates__Default__Password=Password@123
#- ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/Blazor.Server.UI.pfx
#- ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/CleanArchitecture.Blazor.Server.UI.pfx
volumes:
- ${APPDATA}\microsoft\UserSecrets\:/root/.microsoft/usersecrets:ro
- ~/.aspnet/https:/root/.aspnet/https:ro
Expand Down
67 changes: 30 additions & 37 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>CleanArchitecture.Blazor.Application</RootNamespace>
<AssemblyName>CleanArchitecture.Blazor.Application</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ardalis.Specification" Version="7.0.0" />
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="ClosedXML" Version="0.102.1" />
<PackageReference Include="jcamp.FluentEmail.Core" Version="3.2.0" />
<PackageReference Include="jcamp.FluentEmail.MailKit" Version="3.2.0" />
<PackageReference Include="jcamp.FluentEmail.Razor" Version="3.2.0" />
<PackageReference Include="MailKit" Version="4.2.0" />
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.7.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.7.1" />
<PackageReference Include="Fluxor.Blazor.Web" Version="5.9.1" />
<PackageReference Include="Fluxor.Blazor.Web.ReduxDevTools" Version="5.9.1" />
<PackageReference Include="LazyCache" Version="2.4.0" />
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.12" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.12" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.12" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
<PackageReference Include="Hangfire.Core" Version="1.8.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Common\Specification\" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>CleanArchitecture.Blazor.Application</RootNamespace>
<AssemblyName>CleanArchitecture.Blazor.Application</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ardalis.Specification" Version="8.0.0" />
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="ClosedXML" Version="0.104.0-preview2" />
<PackageReference Include="jcamp.FluentEmail.Core" Version="3.7.0" />
<PackageReference Include="jcamp.FluentEmail.MailKit" Version="3.7.0" />
<PackageReference Include="jcamp.FluentEmail.Razor" Version="3.7.0" />
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.8.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.1" />
<PackageReference Include="LazyCache" Version="2.4.0" />
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0-preview3.23201.1" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.7" />
<PackageReference Include="Hangfire.Core" Version="1.8.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
</ItemGroup>
</Project>
31 changes: 0 additions & 31 deletions src/Application/Common/Behaviours/ValidationBehaviour.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Application/Common/Extensions/QueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Ardalis.Specification.EntityFrameworkCore;
using CleanArchitecture.Blazor.Domain.Common;
using CleanArchitecture.Blazor.Domain.Common.Entities;

namespace CleanArchitecture.Blazor.Application.Common.Extensions;

Expand Down
26 changes: 26 additions & 0 deletions src/Application/Common/Extensions/ValidationExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using FluentValidation.Results;

namespace CleanArchitecture.Blazor.Application.Common.Extensions;
public static class ValidationExtensions
{
public static async Task<List<ValidationFailure>> ValidateAsync<TRequest>(this IEnumerable<IValidator<TRequest>> validators, ValidationContext<TRequest> validationContext, CancellationToken cancellationToken = default)
{
if (!validators.Any()) return new List<ValidationFailure>();

var validationResults = await Task.WhenAll(
validators.Select(v => v.ValidateAsync(validationContext, cancellationToken)));

return validationResults
.SelectMany(r => r.Errors)
.Where(f => f != null)
.ToList();
}

public static Dictionary<string, string[]> ToDictionary(this List<ValidationFailure>? failures)
{
return failures != null && failures.Any()
? failures.GroupBy(e => e.PropertyName, e => e.ErrorMessage)
.ToDictionary(g => g.Key, g => g.ToArray())
: new Dictionary<string, string[]>();
}
}
Loading

0 comments on commit 45c225a

Please sign in to comment.