我已经为多个域实现了 IRepository 接口,但我不知道如何调用特定的方法。
下面是代码:
public interface IRepository<T> where T : class
{
IEnumerable<T> GetAll();
void Add(T entity);
void Update(T entity);
}
public interface IProjectRepository : IRepository<ProjectType>, IRepository<Project>, IRepository<ProjectDetail>
{
}
public class ProjectRepository : IProjectRepository
{
// implemenation
}
现在,当我创建 ProjectRepository 类的对象时,它显示了接口的所有方法,但只需要 projecttype 参数。
我不知道,这是正确的实现方式吗?还是有另一种方法来实现类似的事情?