Clean Architecture with ASP.NET Core 3.0 - Jason Taylor - NDC Sydney 2019

NDC Conferences · 200K views · 2019 · 1:02:30

Open on YouTube

Software architecture & designWeb developmenttalk

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about layering, dependency direction and where infrastructure dependencies belong in .NET Clean Architecture projects.

Recommended by 2 people across 2 different months, 2020 to 2024.

What it is

A conference talk by Jason Taylor at NDC Sydney 2019 on structuring ASP.NET Core 3.0 applications with Clean Architecture. It covers project and folder organisation, technology and tooling choices, and how to keep a system simple to build and maintain from development to production.

What people said

Strong rec Marco Talento · 2020-10 · Stack Overflow · on “Unit of work pattern not allowing me to create db context without options”

You shouldn't create a DbContext manually. Why not injecting the DbContext in your UOW class? Then the DI will manage the life cycle of the db context. To be honest I am not a fan of adding a UOW wrapper around EF which already implements the UOW pattern. I would recommend you to see both talks, it will change the way you structure apps forever: [this video] [LINK] Another amazing talk about EF Core details: [LINK] If you want to stick with Repository pattern, please check Ardalis repository with a clear example: [LINK]

Recommends Pavel · 2024-05 · Stack Overflow · on “How to register Infrastructure layer dependencies in Clean Architecture using .NET 6?”

In this presentation in 2019 in Sydney, Jason Taylor provides a good explanation. See 41:20 minute mark. Clean Architecture with ASP.NET Core 3.0 - Jason Taylor - NDC Sydney 2019 [this video] I'm paraphrasing: No layer or component should dependent on infrastructure . It may be confusing, but we have to remember that infrastructure is there just to provide an implementation. Now, having said that, the web project does have a dependency on infrastructure, but that's for dependency injection only . So we should only see the reference to infrastructure in the Startup.cs or Program.cs, so if you see references outside of that, such as in a controller, you know that's a red flag. Hopefully you'll pick

Cites Javier Contreras · 2020-08 · Stack Overflow · on “How do I intercept a method call in C#?”

Maybe it's to late for this answer but here it goes. What you are looking to achieve is built in MediatR library. This is my RequestLoggerBehaviour which intercepts all calls to my business layer. namespace SmartWay.Application.Behaviours { public class RequestLoggerBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> { private readonly ILogger _logger; private readonly IAppSession _appSession; private readonly ICreateLogGrain _createLogGrain; public RequestLoggerBehaviour(ILogger<TRequest> logger, IAppSession appSession, IClusterClient clusterClient) { _logger = logger; _appSession = appSession; _createLogGrain = clusterClient.GetGrain<ICreateLogGrain>(Guid.NewGuid()); }