79146368

Date: 2024-10-31 21:20:54
Score: 0.5
Natty:
Report link

For some reason, the compiler is unable to ascertain that TModel implements IModel, even though it inherits from a class that implements IModel. The solution, fortunately, is simple. Instead of this:

  public Repository<TModel, TKey> where TModel : Model<TKey>

do this:

  public Repository<TModel, TKey> where TModel : Model<TKey>, IModel
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Phoeniceus Agelaius