question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JsonApiDotNetCore.Repositories.IDbContextResolver Error

See original GitHub issue

Description

InvalidOperationException: Unable to resolve service for type ‘JsonApiDotNetCore.Repositories.IDbContextResolver’ while attempting to activate 'JsonApiDotNetCore.Repositories.EntityFrameworkCoreRepository`2

Environment

  • JsonApiDotNetCore Version: 4.0.0-beta1

I am not using EF Core at all - just a basic API that references a library project in the same solution. I am very confused about the EntityFrameworkCoreRepository and it’s need in the project(which I won’t be using in the solution).

Please help in resolving this issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bart-degreedcommented, Sep 15, 2020

Hi @bluedog13, EntityFrameworkCoreRepository is used by default as backing store by JsonApiResourceService. See here for an overview.

If not using EF Core, you can replace the repository with a custom implementation of IResourceRepository<TResource, TId>, which is injected in the service. Or even replace the service layer too, by injecting your own service layer in controllers.

If you’re stuck and need help, please share your controller/service classes (just the class and constructor signature should be enough) and any custom registrations for them you have in Startup.cs. It would even be better to share a repro-project so we can analyze what is going on.

0reactions
bart-degreedcommented, Sep 18, 2020

Glad to hear this works for you now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Namespace JsonApiDotNetCore.Errors
The error that is thrown when assigning and referencing a local ID within the same operation. MissingResourceInRelationship · MissingTransactionSupportException.
Read more >
Namespace JsonApiDotNetCore.Repositories
The error that is thrown when the underlying data store is unable to persist changes. DbContextExtensions · DbContextResolver<TDbContext>.
Read more >
Class JsonApiException
The base class for an Exception that represents one or more JSON:API error objects in an unsuccessful response. [PublicAPI] public class JsonApiException ...
Read more >
Class JsonApiOptions
Indicates whether responses should contain a jsonapi object that contains the highest JSON:API version supported. False by default. public bool ...
Read more >
Class Identifiable<TId>
A convenient basic implementation of IIdentifiable<TId> that provides conversion between typed Id and StringId. public abstract class Identifiable<TId> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found