We need to write hundreds of repository classes and want to base them on an interface, like the one below. Where I’m struggling is on the Get(id), Delete(id) because it’s assuming the table only has one primary key column. We have numerous tables that don’t have a primary key at all, and even more tables that have multiple primary key columns. How should I approach defining those two method in this base interface class?
public interface IRepository<T> where T : class
IEnumerable<T> GetXNumberOfRecords(int recordsToGet=0);
T Get<Tid>(Tid id);
bool Add(T entity);
bool Delete<Tid>(Tid id);
bool Update(T entity);