# WebAPI async task pattern, with IDbContextScopeFactory and automapper

I normally abstract data access code into another layer, but I'm currently prototyping and it's not necessary. Does anyone see any issues with this as a general data query pattern, considering the queries may contain very large amounts of data (which will be consumed by an Angular 2 front end). I just want to be sure my implementation doesn't have any gaping holes regarding the async await pattern, and the context doesn't need to be disposed (normally I would wrap a using around it, but I don't think its necessary here).

IDbContextScopeFactory is a neat EF abstraction detailed here. I may swap it out for the IAmbientDbContextLocator detailed in the blog at a later date, should I need to.

Data.Person is the EF entity. Person is the API layer POCO. I'm using AutoMapper to map between them (rules omitted as they're not relevant here). This code works, but I don't have the tools to generate a mass of data to benchmark it with.

public class PersonController : ApiController {

public PersonController(IDbContextScopeFactory dbFactory) {
_dbFactory = dbFactory;
}

[HttpGet]