Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Application layer access to DbContext? #293

Closed
odairto opened this issue Oct 10, 2021 · 2 comments
Closed

Application layer access to DbContext? #293

odairto opened this issue Oct 10, 2021 · 2 comments

Comments

@odairto
Copy link

odairto commented Oct 10, 2021

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
Copy link

LuanMaik commented Jan 9, 2022

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

@jasontaylordev
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants