Forum Xamarin Xamarin.Forms

Query with multiple Tables

jon78jon78 Member ✭✭✭
edited October 14 in Xamarin.Forms

Hi,
im come back with a question about "design pattern"

I want display a customers page where entity are not only 'name', 'address' but also other customer info (solvency,...etc)

My question is: should i create multiple repository for each entity and then join them entities?

Or is better create a query that map an entity (that not implement INotyfyPropertyChanged because it only show data) with only scope of presentation?

public class CustomerViewModel {
  Name,
 Address,
 LastOrder,
 Solvency,
...
}
var customers = await connection
                .QueryAsync<CustomerViewModel>(
                @"SELECT name, address
                  FROM Customers c
                    INNER JOIN Solvency s
                  ON c.Code= s.Code
                  WHERE ...);

Doing so i create a Repository folder for that class

Tagged:

Best Answer

Answers

Sign In or Register to comment.