sswconsulting / ssw.cleanarchitecture Goto Github PK
View Code? Open in Web Editor NEWSSW Clean Architecture Template
Home Page: https://sswconsulting.github.io/SSW.CleanArchitecture/
License: MIT License
SSW Clean Architecture Template
Home Page: https://sswconsulting.github.io/SSW.CleanArchitecture/
License: MIT License
Split the original Clean Architecture v2 PPT from the retreat into smaller PPT specific for announcing CA v2 template
Work out where to publish the monthly videos
❌ Primitive obsession for IDs
Build error for misuse of strings!
Premise:
Consideration:
Proposed decision:
While working on this template we often have discussions on particular concepts and decide to go one way or another. These decisions should be documented in an organized fashion and made public.
Some possible options:
Resources:
Ensure any tool allows you to easily access the content if we switch to something else.
public class TodoItemConfiguration : IEntityTypeConfiguration<TodoItem>
{
// TODO: Rip out the common pieces that are from BaseEntity
// virtual method, override
// Good marker to enforce that all entities have configuration defined via arch tests
public void Configure(EntityTypeBuilder<TodoItem> builder)
{
builder.HasKey(t => t.Id);
builder.Property(t => t.Id)
.HasConversion(x => x.Value,
x => new TodoItemId(x))
.ValueGeneratedOnAdd();
builder.Property(t => t.Title)
.HasMaxLength(200)
.IsRequired();
}
}
private static IResult HandleException(this HttpContext context, Exception exception)
{
var type = exception.GetType();
if (ExceptionHandlers.ContainsKey(type))
return ExceptionHandlers[type].Invoke(context, exception);
// TODO: Testing around unhandled exceptions
return Results.Problem(statusCode: StatusCodes.Status500InternalServerError,
type: "https://tools.ietf.org/html/rfc7231#section-6.6.1");
}
Add an example of using GraphQL with CAv2 core template
public abstract class AuditableEntity
{
public DateTimeOffset CreatedAt { get; set; }
public string? CreatedBy { get; set; } // TODO: String as userId?
public DateTimeOffset? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; } // TODO: String as userId?
}
AC: GIVEN I am a developer
WHEN I Violate CA
THEN I get build/unit test errors
GIVEN I am a tech lead
WHEN I setup a project best practice
AND Developers violate the practices
THEN They get build/unit test errors
To quickly set up a new project, utilize the dotnet CLI templates so that we can execute a command like:
dotnet new ssw-ca -n MyCleanArchitectureProject --ui BlazorWasm
to produce a ready-to-use solution.
Tasks:
Resources
This includes, WebApi, Application, and Domain Layers
This provides a consistent way to add behavior before / after SaveChangesAsync()
public interface IDateTime
{
// TODO: Talk to Gordon about this - System Clock
public DateTimeOffset Now => DateTimeOffset.UtcNow;
}
Record via GH Discussion
This makes records easier to define
As per the poll in Teams, we chose the name to be SSW.ClearArchitecture
👍
Split the original Clean Architecture PPT from the retreat into smaller PPT specific for Workshops
We should enable NuGet security auditing by default to our csproj files as per:
https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-4/#enabling-security-auditing
Review Gitbook to extract pieces to remove or update to focus more on CA and not external pieces like identity
TODO: Focus on SOLID principles
Add link and close
This adds a smaller dependency on MediatR
Investigate examples for swagger docs. i.e. better docs than:
myWeirdField: "string" vs myWeirdField: "this-silly-string"
Could do this with the use of interfaces + Scrutor
Keep Domain Events and Application Events separate.
Domain Events are added to the Domain Entities and raised from ApplicationDbContext when changes are saved. The domain events are handled using the MediatR INotificationHandler
Application Events can be raised from within the Application Commands/Queries using mediator.Publish()
and are also handled using the MediatR INotificationHandler
This does mean that we will need to pay the price of depending on MediatR in our Domain Layer - but it is a small price to pay.
APPROACH: Remove dependency from EF Core in application layer by adding repository pattern.
AC: Spec pattern allowing better unit testing for things that might be integration tested when using EF Core in application layer
Currently we have the following in WebApi.csproj
:
<UserSecretsId>fc525b0c-3d84-4847-9b4f-840f8db76d87</UserSecretsId>
By having a static UserSecretsId, we will always pick up the same underlying JSON file across all projects.
This should be removed so that a unique UserSecretsId is generated per project when managing secrets.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.