我读过来自 Matt Petters 的关于 DDD 的博客
并且据此据说我们为每个实体创建了一个存储库(接口),然后我们创建了一个 RepositoryFactory,它将提供存储库的实例(声明为接口)
这是使用 DDD 完成项目的方式吗?
我的意思是,我看到我认为他们使用 DDD 但他们直接调用每个存储库的项目,没有涉及工厂
并且
为什么我们需要创建这么多存储库类,为什么不使用类似的东西
public interface IRepository : IDisposable
{
T[] GetAll();
T[] GetAll(Expression<Func> filter);
T GetSingle(Expression<Func> filter);
T GetSingle(Expression<Func> filter, List<Expression<Func>> subSelectors);
void Delete(T entity);
void Add(T entity);
int SaveChanges();
}
我想这可能是违反 SOLID 原则的原因,还是其他原因?