Inheriting and overriding interfaces in C#
- by Daniel A. White
Please note: I am writing this question.
I have these interfaces in a library/framework I am working on:
interface IRepository<TKey,TModel> {
void Remove(TModel entity);
}
interface IRepository<T> : IRepository<int, T> { }
interface ISoftDeleteRepository<TKey,TModel> : IRepository<TKey, TModel> { }
interface ISoftDeleteRepository<TModel>
: ISoftDeleteRepository<int, TModel>, IRepository<TModel> { }
and these implementations
class Repository : IRepository {
void Remove(TModel entity)
{
// actually Delete
}
}
interface IRepository<T> : IRepository<int, T> { }
interface ISoftDeleteRepository<TKey,TModel> : IRepository<TKey, TModel> { }
interface ISoftDeleteRepository<TModel>
: ISoftDeleteRepository<int, TModel>, IRepository<TModel> { }