I don't think DCI is opinionated about this; you can obtain the data
objects in whatever way works best for your particular DCI Context. I
would say it depends on what you consider to be part of the use case; if
processing input from the UI is part of the use case, then it makes
sense to do that inside the Context. I'm not sure that should be a hard
and fast rule though - I think you could equally make the case that the
View and Controller of MVC should be responsible for translating user
input to domain objects, and that a Context focused on doing something
with those objects shouldn't have to know how to obtain them.
I have seen both approaches used in official and contributed examples.
For example, in Trygve's version of the money transfer example, he
creates a Transaction object that's responsible for looking up the bank
Account objects, and passes that Transaction into the MoneyTransfer
context. In Cope's version of the example in the Lean Architecture book,
the MoneyTransfer context is instantiated with account IDs and the
context is responsible for retrieving the Account objects.
In terms of a guideline to follow, I can only think of one rule that
would be true across different systems and languages... If you decide to
retrieve objects from a database inside your Context, I would say to
avoid putting raw database queries there (at least if you're using SQL;
with something like Mongo that provides a find() method in its API it
might be less of an issue). (I realize that's probably not what you're
suggesting, just trying to give a general answer.) My reasoning is that
boilerplate SQL code could be distracting from the main logic of the use
case, making the code harder to read, so it would be good to abstract
that to a data access layer.
I'd also be interested to hear any opinions from others about pros and
cons of these alternatives.