我想實現一個通用的存儲庫,但我被掛住了。這是我的對象模型的總結。問題是具體的存儲庫「UserAccountRepositoryStub」不能編譯。錯誤是:C#通用存儲庫
類型用戶必須轉換爲類型IRepository ...
IRepostory:
public interface IRepository<T> where T : IEntity
{
...
}
摘要庫:
public class AbstractRepository<T> where T : class, IEntity, IRepository<T> {...}
IUserAccountRepository:
public interface IUserAccountRepository
用戶:
public class User : IEntity{...}
UserRepositoryStub(混凝土):
public class UserAccoutRepositoryStub : AbstractRepository<User>, IUserAccountRepository
衛生署!我有限制倒退。謝啦! – Nick