I'm using the Dapper which is a micro ORM used to map the objects according to the tables of the database following the relational model. So, I have some questions regarding mapping and class structure.
To illustrate the situation I created two classes that represent two tables of my database, the two classes are Cliente
and Telefone
, follow the code:
Client Class:
public class Cliente
{
int IdCliente {get; set;}
string Nome {get; set;}
}
Phone Class:
public class Telefone
{
int IdTelefone {get; set;}
int IdCliente {get; set;}
string Numero {get; set;}
}
The relationship of these two classes should represent a 1: N relationship (one for many), ie a customer can have multiple phone numbers.
Questions
- This current class structure complies with Dapper for it to do relational mapping?
- There are other structures that I can follow according to the scenario above?
- How would a query with a
inner join
get the following fieldsNome
(Client) andNumero
(Phone)?