title: System.TypeLoadException Could not load type 'Microsoft.EntityFrameworkCore.Query.RelationalQueryContextFactory'
body: <p>I have written basic simple query which was working before when I was using .net core 2.2 (I have used <a href="https://github.com/linq2db/linq2db.EntityFrameworkCore" rel="nofollow noreferrer">linq2db.EntityFrameworkCore</a>)</p>
  
  <pre><code>projectContext.DocumentAnnotation.ToLinqToDBTable().InsertWithIdentity(() =&gt; new DocumentAnnotation { Name = name, ParentId = parentId }))
  </code></pre>
  
  <p>after upgrade It to .net core 3.0 I am getting below error.</p>
  
  <pre><code>System.TypeLoadException
    HResult=0x80131522
    Message=Could not load type 'Microsoft.EntityFrameworkCore.Query.RelationalQueryContextFactory' from assembly 'Microsoft.EntityFrameworkCore.Relational, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
    Source=linq2db.EntityFrameworkCore
    StackTrace:
     at LinqToDB.EntityFrameworkCore.LinqToDBForEFToolsImplDefault.GetCurrentContext(IQueryable query)
     at LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.ToLinqToDBTable[T](DbSet`1 dbSet)
     at MyProjectBusiness.Repositories.Projects.DocumentAnnotationRepository.SaveAnnotation(Nullable`1 parentId, String name) in E:\MyProject\MyProjectBusiness\MyProjectBusiness\Repositories\Projects\DocumentAnnotationRepository.cs:line 39
     at MyProjectBusiness.Repositories.Projects.DocumentAnnotationRepository.GetDocumentAnnotation(Nullable`1[] parentIds, Boolean isMultiPage) in E:\MyProject\MyProjectBusiness\MyProjectBusiness\Repositories\Projects\DocumentAnnotationRepository.cs:line 69
     at MyProjectWeb.api.Controllers.DocumentAnnotationController.Annotations(JObject documentData) in E:\MyProject\MyProjectweb\MyProjectWeb\Controllers\api\Project\Document\DocumentAnnotationController.cs:line 29
     at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
  </code></pre>
  
  <p>My DocumentAnnotation class is as below.</p>
  
  <pre><code>public partial class DocumentAnnotation
      {
          public DocumentAnnotation()
          {
              DocumentAnnotationValue = new HashSet&lt;DocumentAnnotationValue&gt;();
              DocumentAnnotationValueMultiPage = new HashSet&lt;DocumentAnnotationValueMultiPage&gt;();
              ChildDocumentAnnotation = new HashSet&lt;DocumentAnnotation&gt;();
          }
  
          public int Id { get; set; }
          public string Name { get; set; }
          public int? ParentId { get; set; }
          public bool? IsMultiPage { get; set; }
  
          public virtual DocumentAnnotation Parent { get; set; }
          public virtual ICollection&lt;DocumentAnnotationValue&gt; DocumentAnnotationValue { get; set; }
          public virtual ICollection&lt;DocumentAnnotationValueMultiPage&gt; DocumentAnnotationValueMultiPage { get; set; }
          public virtual ICollection&lt;DocumentAnnotation&gt; ChildDocumentAnnotation { get; set; }
      }
  </code></pre>