Base solution for your next web application
Open Closed

DbContext Broken #162


User avatar
0
pnw created

Recently, I started over with the ABP project generator in order to excise ABPZero from my solution. I created a brand new solution and added all my files back. Something went wrong and now my repositories won't work because of the following runtime error. What does it mean?

An unhandled exception of type 'Castle.MicroKernel.ComponentNotFoundException' occurred in Castle.Windsor.dll

Additional information: No component for supporting the service Scorecard.EntityFramework.ScorecardDbContext was found
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

5 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Did you derived ScorecardDbContext from AbpZeroDbContext?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    hikalkan created
    Support Team

    BTW, "Additional information: No component for supporting the service Scorecard.EntityFramework.ScorecardDbContext was found" means that ScorecardDbContext is not registered to Dependency Injection. Normally, if it's derived from AbpZeroDbContext then it's automatically registered (since AbpZeroDbContext implements ITransientDependency). See document for more information and understand dependency injection better: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection">http://www.aspnetboilerplate.com/Pages/ ... -Injection</a>

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    pnw created

    Somehow I was inheriting from DbContext. Once I switched to AbpDbContext my repositories were happy.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    hikalkan created
    Support Team

    If you're using module-zero then inherit from AbpZeroDbContext, not AbpDbContext. Have a nice day.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    pnw created

    Not using module-zero. It doesn't support my company org structure.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)