I am working in project using generic repository design pattern and i need to get the name of entity(name of table) that sent to the following Add function
public class Repository<TEntity> : IRepository<TEntity> where TEntity:class
{
public TEntity Add(TEntity entity)
{
validate("nameoftable");
TEntity result= _set.Add(entity);
return result;
}
private validate(string entity-name)
{
if (entity-name == "students")
{
////do some work
}
}
i want to get the entity table to use it for some validation before save
Aucun commentaire:
Enregistrer un commentaire