jasontaylordev / NorthwindTraders

Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core.
MIT License
5k stars 1.59k forks source link

Application layer access to DbContext? #293

Closed odairto closed 1 year ago

odairto commented 3 years ago

Hi all. Is it correct the Hadler in Application access the DB Context in Clean Architecture aproach?

public async Task<ProductsListVm> Handle(GetProductsListQuery request, CancellationToken cancellationToken)
        {
                var products = await _context.Products
                .ProjectTo<ProductDto>(_mapper.ConfigurationProvider)
                .OrderBy(p => p.ProductName)
                .ToListAsync(cancellationToken)
        }
LuanMaik commented 2 years ago

He is using INorthwindDbContext to access EF implementation, so it's correct, but I prefer to use the repository pattern.

jasontaylordev commented 1 year ago

Thank you for your interest in this project. This repository has been archived and is no longer actively maintained or supported. We appreciate your understanding. Feel free to explore the codebase and adapt it to your own needs if it serves as a useful reference. If you have any further questions or concerns, please refer to the README for more information.