Hi All,
Typical scinario. I have a Database with several tables.
Using VS ORM tool to generate DataContext classes.
Using the Repository pattern, I will create a repository class per table.
BUT the issue is, I want to use interfaces also for ease of testing without having a dabatase.
My question is:
"Do I have to creare an interface per table also, or can I somehow get away with using 1 interface for all tables? noting that each method will take seperate object. i.e a product update methind will take a product object, but customer update method will take customer objects."
Thanks in advance.
Company Table Interface example
internal interface ICompanies
{
void Create(Company company);
void Delete(Company company);
void Update(Company company);
void Save();
IQueryable<Company> Select();
Company GetSingle(int companyId);
}
Company Locations Interface example
interface ICompanyLocations
{
void Create(CompanyLocation CompanyLocation);
void Delete(CompanyLocation CompanyLocation);
void Update(CompanyLocation CompanyLocation);
IQueryable<CompanyLocation> Select();
void Save();
CompanyLocation GetSingle(CompanyLocationID);
}