110,545
社区成员
发帖
与我相关
我的任务
分享
public abstract class Repository<T> : IRepository<T> where T : EntityBase
{
}
// 有一个仓储的工厂类:
internal class RepositoryFactory
{
// 这里该如何声明缓存字段?
private IDictionary<Type, IRepository<>> repoCache = new Dictionary<Type, IRepository<>>();
public IRepository<T> FindByEntity<T>(Type anEntityType)
{
// 这里先通过 repoCache 查找,如果没有则新建并缓存。
throw new NotImplementedException();
}
}