Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

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


User avatar
0
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=4.9.0.0

Please let us know.


5 Answer(s)
  • User Avatar
    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.

  • User Avatar
    0
    sumitshah created

    Hello,

    Please find the below screen-shot.

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

  • User Avatar
    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.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @bobingham :)

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

  • User Avatar
    0
    sumitshah created

    Yes, I got it. Thanks.