I have a model that looks like this :
public class Task : ITask
{
public int DocumentId { get; set; }
public virtual Document Document { get; set; }
public TaskType TaskType { get; }
public string Value { get; }
}
Now, this class is directly registered as a DbSet
in the DbContext
.
This means that the Document
property must be of concrete type. I want to make this code easily testable, so I want to have the property as an interface which is required by the ITask
interface. What is the general way to approach this problem?
One way that comes to my mind is to put all such classes in a separate assembly but that seems a bit off.
Edit: The ITask
interface is defined in a different assembly so it should not know about the Document
type.