Wally.CleanArchitecture.Template
0.1.1509
See the version list below for details.
dotnet new install Wally.CleanArchitecture.Template::0.1.1509
Wally.CleanArchitecture
[[TOC]]
ToDo
- Add
AggregateRoot
Shadow Properties
orAuditableEntity
abstract class for selectedAggregateRoot
andEntity
:
public DateTime Created { get; set; }
public string? CreatedBy { get; set; }
public DateTime? LastModified { get; set; }
public string? LastModifiedBy { get; set; }
ValueObject
abstract base:
public abstract class ValueObject
{
protected static bool EqualOperator(ValueObject left, ValueObject right)
{
if (ReferenceEquals(left, null) ^ ReferenceEquals(right, null))
{
return false;
}
return ReferenceEquals(left, null) || left.Equals(right);
}
protected static bool NotEqualOperator(ValueObject left, ValueObject right)
{
return !(EqualOperator(left, right));
}
protected abstract IEnumerable<object> GetEqualityComponents();
public override bool Equals(object obj)
{
if (obj == null || obj.GetType() != GetType())
{
return false;
}
var other = (ValueObject)obj;
return this.GetEqualityComponents().SequenceEqual(other.GetEqualityComponents());
}
public override int GetHashCode()
{
return GetEqualityComponents()
.Select(x => x != null ? x.GetHashCode() : 0)
.Aggregate((x, y) => x ^ y);
}
// Other utility methods
}
- Create
DependencyInjection
class inInfrastructure
- Use Aspect Oriented Programming
Components
Swagger
UI: https://localhost:7197/swagger/index.html
Serilog
serilog.json
{
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.ApplicationInsights"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information"
}
},
"WriteTo": [
{
"Name": "Debug"
},
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Properties:j}{NewLine}{Exception}{NewLine}"
}
},
{
"Name": "ApplicationInsights",
"Args": {
"instrumentationKey": "---",
"restrictedToMinimumLevel": "Information",
"telemetryConverter": "Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights"
}
},
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "---",
"tableName": "Log",
"columnOptionsSection": {
"addStandardColumns": [ "LogEvent" ],
"removeStandardColumns": [ "Properties" ]
}
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
],
"Properties": {
"Application": "Wally.CleanArchitecture"
}
}
}
Health Checks
AppVer: https://localhost:7197 Health: https://localhost:7197/healthchecks
UI: https://localhost:7197/healthchecks-ui UI cfg: https://localhost:7197/healthchecks-api/ui-settings
API: https://localhost:7197/healthchecks-api
Webhooks: https://localhost:7197/healthchecks-webhooks
appsettings.json
...
"HealthChecks-UI": {
"DisableMigrations": true,
"HealthChecks": [
{
"Name": "Poll Manager",
"Uri": "/healthChecks"
}
],
"Webhooks": [
{
"Name": "",
"Uri": "",
"Payload": "",
"RestoredPayload": ""
}
],
"EvaluationTimeOnSeconds": 10,
"MinimumSecondsBetweenFailureNotifications": 60,
"MaximumExecutionHistoriesPerEndpoint": 15,
"HealthCheckDatabaseConnectionString": "Data Source=healthChecks"
}
...
Known Issues:
Mapster
Known Issuees:
System.MissingMethodException: Constructor on type 'Mapster.EFCore.MapsterAsyncEnumerable`1[[Wally.CleanArchitecture.Contracts.Responses.Users.GetUserResponse, Wally.CleanArchitecture.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Mapster.EFCore.MapsterQueryableProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.SingleAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Wally.CleanArchitecture.Persistence.Repository`1.GetAsync[TResult](Guid id, CancellationToken cancellationToken) in C:\repo\wally\wally.CleanArchitecture\src\Wally.CleanArchitecture.Persistence\Repository.cs:line 0
at Wally.CleanArchitecture.Application.Users.Queries.GetUserQueryHandler.HandleAsync(GetUserQuery query, CancellationToken cancellationToken) in C:\repo\wally\wally.CleanArchitecture\src\Wally.CleanArchitecture.Application\Users\Queries\GetUserQueryHandler.cs:line 19
at Wally.CleanArchitecture.Application.Abstractions.QueryHandler`2.Handle(TQuery query, CancellationToken cancellationToken) in C:\repo\wally\wally.CleanArchitecture\src\Wally.CleanArchitecture.Application\Abstractions\QueryHandler.cs:line 16
at MediatR.Internal.RequestHandlerWrapperImpl`2.<>c__DisplayClass1_0.<Handle>g__Handler|0()
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
AutoMapper
Tests
curl -X GET "https://localhost:7197/Users/3fa85f64-5717-4562-b3fc-2c963f66afa6" -H "accept:
application/json;odata.metadata=minimal;odata.streaming=true"
curl -X GET "https://localhost:7197/Users" -H "accept: application/json;odata.metadata=minimal;odata.streaming=true"
curl -X GET "https://localhost:7197/Users?$orderby=Id&$top=1" -H "accept:
application/json;odata.metadata=minimal;odata.streaming=true"
curl -X GET "https://localhost:7197/Users?$count=true&$orderby=Id&$top=0" -H "accept:
application/json;odata.metadata=minimal;odata.streaming=true"
curl -X GET "https://localhost:7197/Users?$count=true&$orderby=Id&$skip=2&$top=2" -H "accept:
application/json;odata.metadata=minimal;odata.streaming=true"
{
"items":[
{"id":"3fa85f64-5717-4562-b3fc-2c963f66afa8","name":"testDbData3"}
],
"pageInfo":{
"index":1,
"size":2,
"totalItems":3
}
}
curl -X GET "https://localhost:7197/Users?$orderby=Name%20desc&$top=3" -H "accept: application/json;odata.metadata=minimal;odata.streaming=true"
{
"items":[
{"id":"3fa85f64-5717-4562-b3fc-2c963f66afa8","name":"testDbData3"},
{"id":"3fa85f64-5717-4562-b3fc-2c963f66afa7","name":"testDbData2"},
{"id":"3fa85f64-5717-4562-b3fc-2c963f66afa6","name":"testDbData1"}
],
"pageInfo":{
"index":0,
"size":3,
"totalItems":3
}
}
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.3.2884 | 76 | 11/17/2024 |
1.3.2872 | 88 | 11/16/2024 |
1.3.2866 | 77 | 11/9/2024 |
1.3.2865 | 76 | 11/9/2024 |
1.3.2862 | 74 | 11/8/2024 |
1.3.2860 | 78 | 11/7/2024 |
1.3.2829 | 94 | 10/24/2024 |
1.3.2783 | 86 | 10/23/2024 |
1.3.2746 | 111 | 10/18/2024 |
1.3.2735 | 95 | 10/18/2024 |
1.3.2721 | 102 | 10/18/2024 |
1.3.2720 | 77 | 10/17/2024 |
1.3.2710 | 102 | 10/10/2024 |
1.3.2704 | 88 | 10/9/2024 |
1.3.2680 | 85 | 10/2/2024 |
1.3.2674 | 102 | 9/25/2024 |
1.3.2665 | 103 | 9/13/2024 |
1.3.2654 | 106 | 8/26/2024 |
1.3.2652 | 106 | 8/5/2024 |
1.3.2650 | 78 | 7/30/2024 |
1.3.2638 | 125 | 7/11/2024 |
1.3.2634 | 94 | 7/10/2024 |
1.3.2621 | 129 | 7/6/2024 |
1.3.2615 | 127 | 6/27/2024 |
1.3.2584 | 236 | 5/26/2024 |
1.3.2579 | 138 | 5/25/2024 |
1.3.2575 | 104 | 5/25/2024 |
1.3.2571 | 103 | 5/25/2024 |
1.3.2570 | 138 | 5/24/2024 |
1.3.2563 | 137 | 5/23/2024 |
1.3.2562 | 89 | 5/23/2024 |
1.3.2560 | 116 | 5/22/2024 |
1.3.2557 | 130 | 5/21/2024 |
1.3.2554 | 95 | 5/21/2024 |
1.3.2551 | 126 | 5/20/2024 |
1.3.2547 | 166 | 5/17/2024 |
1.3.2537 | 104 | 5/16/2024 |
1.3.2536 | 92 | 5/16/2024 |
1.3.2535 | 252 | 5/9/2024 |
1.3.2527 | 103 | 4/26/2024 |
1.3.2510 | 111 | 4/24/2024 |
1.3.2490 | 161 | 4/13/2024 |
1.3.2473 | 159 | 4/8/2024 |
1.3.2471 | 167 | 4/8/2024 |
1.3.2431 | 178 | 4/4/2024 |
1.3.2404 | 323 | 3/22/2024 |
1.3.2401 | 175 | 3/21/2024 |
1.3.2366 | 1,038 | 2/21/2024 |
1.3.2365 | 380 | 2/21/2024 |
1.3.2347 | 700 | 2/9/2024 |
1.3.2248 | 2,252 | 12/6/2023 |
1.3.2243 | 565 | 12/5/2023 |
1.3.2227 | 945 | 11/26/2023 |
1.3.2222 | 685 | 11/26/2023 |
1.3.2212 | 821 | 11/18/2023 |
1.3.2209 | 537 | 11/17/2023 |
1.3.2172 | 1,097 | 11/1/2023 |
1.3.2166 | 767 | 10/30/2023 |
1.3.2163 | 727 | 10/29/2023 |
1.3.2149 | 992 | 10/18/2023 |
1.3.2137 | 1,142 | 10/3/2023 |
1.3.2108 | 765 | 9/25/2023 |
1.3.2093 | 795 | 9/17/2023 |
1.3.2086 | 825 | 8/27/2023 |
1.3.2085 | 895 | 8/27/2023 |
1.3.2042 | 986 | 6/23/2023 |
1.3.2023 | 871 | 6/15/2023 |
1.3.1982 | 950 | 5/28/2023 |
1.3.1974 | 805 | 5/26/2023 |
1.3.1954 | 827 | 5/20/2023 |
1.3.1948 | 858 | 5/18/2023 |
1.3.1947 | 706 | 5/18/2023 |
1.3.1941 | 893 | 5/17/2023 |
1.3.1933 | 949 | 5/15/2023 |
1.3.1913 | 864 | 5/12/2023 |
1.3.1912 | 985 | 5/12/2023 |
1.3.1861 | 1,133 | 3/24/2023 |
1.3.1860 | 1,009 | 3/24/2023 |
1.3.1850 | 887 | 3/18/2023 |
1.3.1847 | 1,008 | 3/15/2023 |
1.3.1846 | 943 | 3/14/2023 |
1.3.1844 | 1,018 | 3/14/2023 |
1.3.1835 | 817 | 3/9/2023 |
1.3.1834 | 854 | 3/9/2023 |
1.3.1832 | 806 | 3/9/2023 |
1.3.1829 | 891 | 3/9/2023 |
1.3.1817 | 968 | 3/3/2023 |
1.2.1814 | 1,242 | 2/27/2023 |
1.2.1811 | 1,086 | 2/20/2023 |
1.2.1767 | 1,162 | 1/18/2023 |
1.2.1760 | 1,190 | 1/14/2023 |
1.2.1743 | 1,232 | 12/25/2022 |
1.2.1701 | 1,245 | 11/23/2022 |
1.2.1690 | 1,243 | 11/14/2022 |
1.2.1689 | 1,251 | 11/14/2022 |
1.2.1687 | 1,241 | 11/14/2022 |
1.2.1685 | 1,218 | 11/11/2022 |
1.2.8 | 1,231 | 11/1/2022 |
1.2.7 | 1,042 | 11/1/2022 |
1.2.6 | 1,269 | 11/1/2022 |
1.2.5 | 1,381 | 10/4/2022 |
1.2.4 | 1,368 | 9/9/2022 |
1.2.3 | 1,452 | 6/9/2022 |
1.2.2 | 1,259 | 6/9/2022 |
1.2.1 | 1,252 | 4/17/2022 |
1.2.0 | 1,446 | 4/17/2022 |
1.1.1553 | 1,390 | 6/10/2022 |
1.1.1516 | 1,243 | 4/17/2022 |
1.1.1515 | 1,450 | 4/17/2022 |
1.1.0 | 1,519 | 3/22/2022 |
0.1.1514 | 1,374 | 4/17/2022 |
0.1.1513 | 1,349 | 4/16/2022 |
0.1.1512 | 1,367 | 4/16/2022 |
0.1.1509 | 1,480 | 4/16/2022 |
0.1.1487 | 1,396 | 3/29/2022 |
0.1.1471 | 1,390 | 3/20/2022 |
0.1.1470 | 1,532 | 3/20/2022 |
0.1.1463 | 1,445 | 3/20/2022 |
0.1.1461 | 1,376 | 3/19/2022 |
0.1.1454 | 1,492 | 3/19/2022 |
0.1.1452 | 1,516 | 3/19/2022 |
0.1.1437 | 1,386 | 3/13/2022 |
0.1.1433 | 1,580 | 2/15/2022 |
0.1.1426 | 1,649 | 2/10/2022 |
0.1.1422 | 1,565 | 2/10/2022 |
0.1.1398 | 1,495 | 1/22/2022 |
0.1.1393 | 1,337 | 1/16/2022 |
0.1.1391 | 1,539 | 1/16/2022 |
0.1.1388 | 1,615 | 1/16/2022 |