Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't inject the repository. #20102

Closed
1957993455 opened this issue Jun 25, 2024 · 2 comments
Closed

Can't inject the repository. #20102

1957993455 opened this issue Jun 25, 2024 · 2 comments

Comments

@1957993455
Copy link

1957993455 commented Jun 25, 2024

 Volo.Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter[0]
      An exception was thrown while activating Blog.Ling.Application.Services.User.UserService -> Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`3[[Ling.Blog.EntityFrameworkCore.BlogDbContext, Ling.Blog.EntityFrameworkCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Blog.Ling.Domain.Entities.UserEntity, Blog.Ling.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].
      Autofac.Core.DependencyResolutionException: An exception was thrown while activating Blog.Ling.Application.Services.User.UserService -> Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`3[[Ling.Blog.EntityFrameworkCore.BlogDbContext, Ling.Blog.EntityFrameworkCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Blog.Ling.Domain.Entities.UserEntity, Blog.Ling.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].
       ---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`3[Ling.Blog.EntityFrameworkCore.BlogDbContext,Blog.Ling.Domain.Entities.UserEntity,System.Guid]' can be invoked with the available services and parameters:
      Cannot resolve parameter 'Volo.Abp.EntityFrameworkCore.IDbContextProvider`1[Ling.Blog.EntityFrameworkCore.BlogDbContext] dbContextProvider' of constructor 'Void .ctor(Volo.Abp.EntityFrameworkCore.IDbContextProvider`1[Ling.Blog.EntityFrameworkCore.BlogDbContext])'.

这是我efcore的模块代码

[DependsOn(typeof(AbpEntityFrameworkCoreModule),
    typeof(AbpEntityFrameworkCoreMySQLModule))]
public class BlogEfCoreModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var services = context.Services;
        Configure<AbpDbConnectionOptions>(opt =>
        {
            opt.ConnectionStrings.Default = context.Services.GetConfiguration().GetConnectionString("DefaultConnection");
        });

        services.AddAbpDbContext<BlogDbContext>(opt =>
        {
            opt.AddDefaultRepositories(true);
        });
    }
}
@maliming maliming changed the title 仓储注入失败 Can't inject the repository. Jun 25, 2024
@maliming
Copy link
Member

hi

  • Your ABP Framework version.
  • Steps needed to reproduce the problem.

@Pantex9
Copy link

Pantex9 commented Aug 26, 2024

Hi, do you know if this issue is still open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants