2011-10-21 25 views
0

我有两个接口,我感到困惑的命名约定:哪个是工作单元,哪个是存储库?

interface InterfaceA { 
    IDbSet<Patient> Patients { get; } 
    // others like above 
} 

interface InterfaceB : InterfaceA { 
    int Commit(); 
} 

class DbContext : InterfaceB { 
    public IDbSet<Patient> Patients { get; set; } 

    int Commit() { 
     return this.SaveChanges(); 
    } 
} 

我不想混淆我的团队的其他程序员。哪个接口是工作单元,哪个接口是存储库?

回答

0

InterfaceA是存储库。

原因:

库是负责保存数据,并InterfaceB没有数据的概念被持久化。