Skip to content

Instantly share code, notes, and snippets.

@msciborski
Created June 24, 2020 17:40
Show Gist options
  • Save msciborski/44b1f22dcb8058789658b7418cce41ac to your computer and use it in GitHub Desktop.
Save msciborski/44b1f22dcb8058789658b7418cce41ac to your computer and use it in GitHub Desktop.
[Route("api/[controller]")]
[ApiController]
public class TestController : ControllerBase
{
private readonly SenderFactory _senderFactory;
public TestController(SenderFactory senderFactory)
{
_senderFactory = senderFactory;
}
[HttpGet()]
public async Task<IActionResult> SendMessage(string senderType)
{
var sender = _senderFactory(senderType);
await sender.Send("Hi! Autofac is nice!");
return Ok();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment