In there any value in using IoC resolvable interfaces to specify DTOs?
Fer example:
private readonly IGetTransactionsQuery _query;
private readonly ICreateTransactionCommand _createCommand;
public TransactionsController(
IGetTransactionsQuery query,
ICreateTransactionCommand createCommand)
{
_query = query;
_createCommand = createCommand;
}
[EnableQuery]
public IQueryable<ITransactionQueryModel> Get()
{
return _query.Execute();
}
public async Task<IHttpActionResult> Post(ICreateTransactionModel transaction)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
await _createCommand.Execute(transaction);
return Created(transaction);
}
Here, I am using ITransactionQueryModel and ICreateTransactionModel, instead of the concretions. Is there any business value here? What scenarios can benefit from this approach? I can think of a few, but wanted to get some consensus of use case scenarios
Note: I am only referring to the controller "action" methods, not the Constructor, for which the benefit of having IoC is obvious