Base solution for your next web application
Open Closed

Giving error "Error CS0103 The name 'Context' does not exist in the current context" #10828

sumitshah created
  • What is your product version? Product version od Net6.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

If issue related with ABP Framework

  • What is ABP Framework version? We have already updated ABP framework packages.

We are migrating application from NetCore 2.2 to .Net 6.0 version. While compiling it is throwing error "Error CS0103 The name 'Context' does not exist in the current context". It is giving from EntityFrameworkCore project.

We are using following packages. Microsoft.EntityFrameworkCore.Design 6.0.0 Microsoft.EntityFrameworkCore.SqlServer 6.0.0 Microsoft.EntityFrameworkCore.Tools 6.0.0 Microsoft.NETCore.App 2.2.8

The "Context" object is from "Abp.EntityFrameworkCore.Repositories" in 'EfCoreRepositoryBase' class of 'TDbContext' type. We are refereing, Abp.EntityFrameworkCore, Version=

Please let us know.

5 Answer(s)
  • 0
    musa.demir created

    Hi @sumitshah

    Can you please share more information about your error. Full error message you get, screenshot and/or codes itself.

  • 0
    sumitshah created


    Please find the below screen-shot.

    This "Context" object has reference from "Abp.EntityFrameworkCore.Repositories".

  • 0
    BobIngham created

    Hi @sumitshah,

    See: Dbcontext not accessible for calling stored procedures in Application Project

    I had a similar problem when upgrading to 10.4.0 and came across it again this morning with 11.0.0. The answer is at the foot of the issue.

  • 0
    ismcagdas created
    Support Team

    Thanks @bobingham :)

    @sumitshah you can use GetContext or GetContextAsync methods to get a DbContext.

  • 0
    sumitshah created

    Yes, I got it. Thanks.