public Curso Read(Guid id) { using (var c = new Mono.Data.Sqlite.SqliteConnection(Database.ConnectionString)) { var sql = @"select * from Curso c left join Setor s on s.Id = c.SetorId where c.Id = @Id"; var data = c.Query<Curso, Setor, Curso>(sql, (curso, setor) => { curso.Setor = setor; return curso; }, new {Id = id}); return data.First(); } }
public IQueryable<Curso> ReadAll() { using (var c = new Mono.Data.Sqlite.SqliteConnection(Database.ConnectionString)) { return c.Query<Curso> ("select * from Curso").AsQueryable(); } }