I have two interfaces and I’m confused about the naming conventions:
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();
}
}
I don’t want to confuse the other coders on my team. Which interface is the unit of work and which one is the repository?
InterfaceA is the repository.
Reason:
A repository is responsible for persisting data, and InterfaceB has no concept of data to be persisted.