Skip to content

Instantly share code, notes, and snippets.

@jfbueno
Last active June 9, 2019 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfbueno/a44602eb306a531554c5054f15122a00 to your computer and use it in GitHub Desktop.
Save jfbueno/a44602eb306a531554c5054f15122a00 to your computer and use it in GitHub Desktop.
public class EventosRepository
{
public Evento[] ObterEventos()
{
var eventos = Connection.Query<Evento>("Select * From Eventos Limit X, Y");
ComporRelacionados(eventos);
return eventos;
}
private void ComporRelacionados(Evento[] eventos)
{
foreach(var evento in eventos)
{
evento.Convidados =
Connection.Query<Convidado>("Select * From Convidados Where EventoId = @id", new { id = evento.Id } );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment