I am working on a program to manage my personal finances. I have an SQLite database that is storing all of the data, and I am able to load/save accounts, bills, payments, etc.
What I am looking to do, is load the account name of the associated account based on the PayeeId
of each Payment
. I know how to achieve this using SQL, but my data is set up using repositories. For example, I load the Payments
by calling
var payments = await _paymentsRepository.LoadAllAsync();
And the LoadAllAsync()
method is in RepositoryBase
class, and looks like so:
public async Task<IEnumerable<TTable>> LoadAllAsync()
{
var query = _sqliteService.Conn.Table<TTable>();
var array = (await query.ToListAsync()).ToArray();
return array;
}
and is declared in the IPaymentsRepository
interface like so:
Task<IEnumerable<Payment>> LoadAllAsync();
Each Payment
object has a PayeeId
property that links to the Payee
for that Payment
. The Payment
itself doesn't store any of the other information about the Payee
, but I would like to be able to load the PayeeName
property to display with the Payment
information. Is there a simple way to do this, or will I have to create a separate ViewModel
to store the "hybrid" data containing both the Payment
information as well as the Payee
information?
Aucun commentaire:
Enregistrer un commentaire