How would I do to search two or more tables.
In the system I'm doing, I have the Boat, BarOperationType, and BarBase
My mapping is as follows:
HasRequired(c => c.ClasseBarco)
.WithMany(c => c.Barcos)
.HasForeignKey(c => c.ClasseBarcoId);
HasRequired(c => c.TipoDeOperacaoDoBarco)
.WithMany(c => c.Barcos)
.HasForeignKey(c => c.TipoOperacaoId);
I made a generic repository for searching
public virtual IEnumerable<TEntity> Buscar(Expression<Func<TEntity, bool>> predicate)
{
return Dbset.Where(predicate);
}
And I use this generic repository to do specific searches for the boats class, here are some examples below:
public IEnumerable<Barco> ObterAtivos()
{
return Buscar(c => c.Ativo && !c.Excluido);
}
public Barco ObterPorNome(string nome)
{
return Buscar(c => c.Nome == nome).FirstOrDefault();
}
And if I want to fetchBarcoeOperation Type andBarcoClass, which are different tables, but which are related to boating table, how would I do?
My idea is to show this data in a table
Follow below how is my bank