Skip to content

Commit

Permalink
feat: apply directory props
Browse files Browse the repository at this point in the history
  • Loading branch information
ntxinh committed Feb 1, 2024
1 parent 7109fb4 commit 478aba3
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 277 deletions.
24 changes: 21 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ dotnet_naming_style.camelcase.capitalization = camel_case

# Rules:

# SA1101: Prefix local calls with this
dotnet_diagnostic.SA1101.severity = none

# Custom

# IDE0005: Using directive is unnecessary
Expand Down Expand Up @@ -293,3 +290,24 @@ csharp_style_namespace_declarations = file_scoped:warning
# dotnet_naming_rule.private_static_fields_none.symbols = private_static_fields
# dotnet_naming_rule.private_static_fields_none.style = underscored
# dotnet_naming_rule.private_static_fields_none.severity = none

##
## StyleCop.Analyzers
##

dotnet_diagnostic.SA0001.severity = None
dotnet_diagnostic.SA1101.severity = None
dotnet_diagnostic.SA1200.severity = None
dotnet_diagnostic.SA1201.severity = None
dotnet_diagnostic.SA1208.severity = None
dotnet_diagnostic.SA1309.severity = None
dotnet_diagnostic.SA1310.severity = None
dotnet_diagnostic.SA1313.severity = None
dotnet_diagnostic.SA1400.severity = None
dotnet_diagnostic.SA1503.severity = None
dotnet_diagnostic.SA1512.severity = None
dotnet_diagnostic.SA1515.severity = None
dotnet_diagnostic.SA1600.severity = None
dotnet_diagnostic.SA1601.severity = None
dotnet_diagnostic.SA1602.severity = None
dotnet_diagnostic.SA1633.severity = None
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
},
"[csharp]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll": true,
"source.sortMembers": true,
"source.organizeImports": "explicit",
"source.fixAll": "explicit",
"source.sortMembers": "explicit"
},
"editor.formatOnSave": true
},
Expand Down
8 changes: 7 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<!-- <Nullable>enable</Nullable> -->
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<!-- <TreatWarningsAsErrors>true</TreatWarningsAsErrors> -->

<!-- This part specifies the ruleset file name. Change to something
more appropriate if not using StyleCop. -->
<CodeAnalysisRuleSet>$(SolutionDir)StyleCop.ruleset</CodeAnalysisRuleSet>
Expand All @@ -8,7 +14,7 @@
top-level stylecop.json file be used by all projects. Skip this
altogether if you are not spefically using StyleCop. -->
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
<PackageReference Include="StyleCop.Analyzers">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
49 changes: 49 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="NPOI" Version="2.6.2" />
<PackageVersion Include="Quartz.AspNetCore" Version="3.7.0" />
<PackageVersion Include="Refit.HttpClientFactory" Version="6.0.38" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageVersion Include="AutoMapper" Version="10.1.1" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="10.2.1" />
<!-- <PackageVersion Include="FluentValidation" Version="11.9.0" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" /> -->
<PackageVersion Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.3" />
<PackageVersion Include="AspNetCore.HealthChecks.UI" Version="5.0.1" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
<PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageVersion Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<!-- <PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> -->

<PackageVersion Include="dbup" Version="4.6.0" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" />

<!-- Test -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageVersion Include="Moq" Version="4.16.1" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />

<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.3.0" />

<PackageVersion Include="FluentAssertions" Version="5.10.3" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageVersion Include="coverlet.collector" Version="3.0.3" />
</ItemGroup>
</Project>
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@
- Entity Framework Core
- .NET Core Native DI
- AutoMapper
- FluentValidator
- FluentValidation
- MediatR
- Swagger UI
- MSSQL
- xUnit
- Moq
- Fluent Assertions
- FluentAssertions
- Polly
- Refit
- DbUp
- NPOI
- Quartz
- StyleCop

# Design Patterns
- Domain Driven Design
Expand Down Expand Up @@ -69,7 +72,7 @@
}
```

- LocalDB is a packaging mechanism for SQL Server Express Edition, and is only available for Windows, use [Docker Images](https://hub.docker.com/_/microsoft-mssql-server) for Linux / macOS
- LocalDB is a packaging mechanism for SQL Server Express Edition, and is only available for Windows, use [Microsoft SQL Server](https://hub.docker.com/_/microsoft-mssql-server) or [Azure SQL Edge](https://hub.docker.com/_/microsoft-azure-sql-edge) for Linux / macOS

- `secrets.json` for Linux / macOS:

Expand Down Expand Up @@ -188,30 +191,30 @@ podman-compose stop
- [x] [REST Client](https://github.com/Huachao/vscode-restclient)
- [x] [StyleCopAnalyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) (Use [default rules set](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/rulesets/StyleCopAnalyzersDefault.ruleset) and disable 9 rules: SA0001, SA1200, SA1201, SA1309, SA1400, SA1512, SA1600, SA1601, SA1633)
- [x] [RoslynAnalyzers](https://github.com/dotnet/roslyn-analyzers) (It was enabled by default for .NET 5 or above)
- [x] [Secret Manager](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=linux)
- [ ] [OmniSharp Roslyn](https://github.com/OmniSharp/omnisharp-roslyn)
- [ ] [sonar-dotnet](https://github.com/SonarSource/sonar-dotnet)
- [ ] [docfx](https://github.com/dotnet/docfx)
- [ ] Autofac or Scrutor
- [ ] Bogus
- [ ] [Autofac](https://github.com/autofac/Autofac)
- [ ] [Bogus](https://github.com/bchavez/Bogus)
- [ ] Scaffold
- [ ] Data Seeding
- [ ] Logging
- [ ] OAuth2, OIDC (OpenId Connect)
- [ ] Search
- [ ] Kafka, RabbitMQ
- [ ] Microservices, API Gateway (Ocelot, yarp)
- [ ] [Kafka](https://github.com/apache/kafka), [RabbitMQ](https://github.com/rabbitmq/rabbitmq-server)
- [ ] Microservices, API Gateway ([Ocelot](https://github.com/ThreeMammals/Ocelot), [yarp](https://github.com/microsoft/reverse-proxy))
- [ ] Multi-tenancy
- [ ] Primary Key to Integer
- [ ] File storage: Upload/Download
- [ ] Globalization & Localization
- [ ] Caching
- [ ] Kestrel
- [ ] Secret Manager
- [ ] Session & Cookie
- [ ] Encryption
- [ ] EF: No-tracking queries
- [ ] Dapper, Dapper Contrib (Optional)
- [ ] RepoDB
- [ ] [Dapper](https://github.com/DapperLib/Dapper), [Dapper Contrib](https://github.com/DapperLib/Dapper.Contrib) (Optional)
- [ ] [RepoDB](https://github.com/mikependon/RepoDB)
- [ ] BulkInsert, BulkUpdate, Async method for IRepository

# References
Expand Down
8 changes: 1 addition & 7 deletions Src/DDD.Application/DDD.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Application</RootNamespace>
<AssemblyName>DDD.Application</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 2 additions & 7 deletions Src/DDD.CLI.Migration/DDD.CLI.Migration.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dbup" Version="4.6.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="dbup" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 2 additions & 8 deletions Src/DDD.Domain.Core/DDD.Domain.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Domain.Core</RootNamespace>
<AssemblyName>DDD.Domain.Core</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="10.2.1" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="FluentValidation.AspNetCore" />
<PackageReference Include="MediatR" />
</ItemGroup>

</Project>
12 changes: 3 additions & 9 deletions Src/DDD.Domain/DDD.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Domain</RootNamespace>
<AssemblyName>DDD.Domain</AssemblyName>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DDD.Domain.Core\DDD.Domain.Core.csproj" />
<ProjectReference Include="..\DDD.Infra.CrossCutting.Bus\DDD.Infra.CrossCutting.Bus.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NPOI" Version="2.6.2" />
<PackageReference Include="Quartz.AspNetCore" Version="3.7.0" />
<PackageReference Include="Refit.HttpClientFactory" Version="6.0.38" />
<PackageReference Include="NPOI" />
<PackageReference Include="Quartz.AspNetCore" />
<PackageReference Include="Refit.HttpClientFactory" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.CrossCutting.Bus</RootNamespace>
<AssemblyName>DDD.Infra.CrossCutting.Bus</AssemblyName>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DDD.Domain.Core\DDD.Domain.Core.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.CrossCutting.Identity</RootNamespace>
<AssemblyName>DDD.Infra.CrossCutting.Identity</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.CrossCutting.IoC</RootNamespace>
<AssemblyName>DDD.Infra.CrossCutting.IoC</AssemblyName>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DDD.Application\DDD.Application.csproj" />
<ProjectReference Include="..\DDD.Domain\DDD.Domain.csproj" />
Expand Down
10 changes: 2 additions & 8 deletions Src/DDD.Infra.Data/DDD.Infra.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.Data</RootNamespace>
<AssemblyName>DDD.Infra.Data</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Src/DDD.Services.Api/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected bool IsValidOperation()
return !_notifications.HasNotifications();
}

protected new IActionResult Response(object? result = null)
protected new IActionResult Response(object result = null)
{
if (IsValidOperation())
{
Expand Down
27 changes: 11 additions & 16 deletions Src/DDD.Services.Api/DDD.Services.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>DDD.Services.Api</RootNamespace>
<AssemblyName>DDD.Services.Api</AssemblyName>
<UserSecretsId>51c0770a-8c88-4362-b3b5-a8936796ecef</UserSecretsId>
<!-- Temp: suppress the warning -->
<NoWarn>$(NoWarn);AD0001;NETSDK1206</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.3" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" />
<PackageReference Include="AspNetCore.HealthChecks.UI" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" />
<PackageReference Include="Swashbuckle.AspNetCore" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 478aba3

Please sign in to comment.