1
I have my Repository, with add method
public virtual T Adiciona(T entity)
{
_dbSet.Add(entity);
return entity;
}
Not if it’s possible,
All my classes inherit from "Modelbase"
public class ModelBase
{
[Key]
public int Id { get; set; }
public int EmpresaId { get; set; }
}
This company is a property of the user, which is the company that it is linked to
I want to record all my models that inherit from modelbase, I want to pass the company id now
Any idea how to do that?
Gypsy, because I am receiving a generic, he does not even accept that I pass "Entity. Property = value"
– Rod
@Rod Declare your generic as
where T: ModelBase
– Leonel Sanches da Silva