I have the following entities:
public interface IMyEntity
{
[Key]
int Id { get; set; }
IMyDetail MyDetail { get; set; }
ICollection
I had this issue too on some on my models and not others and tried using the accepted answer. Then I dug a bit deeper as to what was different on the models that worked.
Fix was to change from using ICollection to use IEnumerable instead and the issues went away, so far.
This removed the need to use the below code in accepted answer:
public interface IParent
where TChild : IChild
{
ICollection Children { get; set; }
and it became
public interface IParent
{
IEnumerable Children { get; set; }
which is much simpler.