title: How to setup readonly collection property with backing field in EF Core 2.2
body: <p>I am trying to create an entity class which will expose a related collection through a readonly property, like this:</p>
  
  <pre><code>public class MyEntity: Entity
  {
      public int Id{ get; private set; }
      private IList&lt;RelatedEntity&gt; _relatedEntities = new List&lt;RelatedEntity&gt;();
      public IReadOnlyList&lt;RelatedEntity&gt; RelatedEntities =&gt; _relatedEntities.ToList().AsReadOnly();
  }
  </code></pre>
  
  <p>The builder class looks like this:</p>
  
  <pre><code>public void Configure(EntityTypeBuilder&lt;MyEntity&gt; builder)
  {
      builder.HasKey(x=&gt;x.Id);
      builder.Property&lt;IReadOnlyList&lt;RelatedEntity&gt;&gt;("RelatedEntities")
          .HasField("_relatedEntities ")
          .UsePropertyAccessMode(PropertyAccessMode.Field);
  }
  </code></pre>
  
  <p>It builds but crashes at runtime with the exception:</p>
  
  <blockquote>
    <p>InvalidOperationException: The specified field '_relatedEntities' of type 'IList' cannot be used for the property 'MyEntity.RelatedEntities ' of type 'IReadOnlyList'. Only backing fields of types that are assignable from the property type can be used.</p>
  </blockquote>
  
  <p>Could you provide a working example how to deal with this issue ?</p>