Month: March 2021

Control Freak controllers – Dependency Injection

This first version of the code showcases the lack of flexibility that creating dependencies using the new keyword brings when the time to update the application arises. Here’s the initial controller that leverages an in-memory collection: using Microsoft.AspNetCore.Mvc;using Strategy.Services;namespace Strategy.Controllers;[Route(“travel/[controller]”)][ApiController]public class ControlFreakLocationsController : ControllerBase{    [HttpGet]    public async Task<IEnumerable<LocationSummary>> GetAsync(CancellationToken cancellationToken)    {        var locationService = new […]



         


          Terms of Use | Accessibility Privacy