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.

Custom ABP module - dependency injection error - Console Application

See original GitHub issue
  • Your Abp package version. 7.3.0
  • Your base framework: .Net Core.
  • Exception message and stack trace if available.:
    ** No component for supporting the service IInventoryRepository was found’

I have downloaded Startup template as AspNetCore + Angular

I’ve created custom module console application look like this (as I followed migration module)

Custom module has ApplicationModule project dependency

[DependsOn(typeof(InventoryApplicationModule))]
public class MasterDataSubscriberModule : AbpModule
{

    public override void PreInitialize()
    {
        Configuration.BackgroundJobs.IsJobExecutionEnabled = false;

    }

    public override void Initialize()
    {
        IocManager.RegisterAssemblyByConvention(typeof(MasterDataSubscriberModule).GetAssembly());
    }
}

This is program.cs

using (var bootstrapper = AbpBootstrapper.Create<MasterDataSubscriberModule>())
{
    bootstrapper.Initialize();

    using var scope = bootstrapper.IocManager.CreateScope();

     var repository = scope.ResolveAsDisposable<IInventoryRepository>();

    Console.ReadLine();
}

I tried to get some repository from container. But I’ve took

“Castle.MicroKernel.ComponentNotFoundException: ‘No component for supporting the service IInventoryRepository was found’”

IInventoryRepository has kinda custom repository implementation

public interface IInventoryRepository : IRepository<Inventory, int>
{
}

I need help Thanks.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ismcagdascommented, May 5, 2023

@onurcanyilmaz I assume this is because the implemenation of the repository is in EntityFrameworkCore project.

0reactions
sajasbanacommented, Jan 10, 2023
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency Injection | Documentation Center | ABP.IO
ABP's Dependency Injection system is developed based on Microsoft's dependency injection extension library (Microsoft.Extensions.DependencyInjection nuget ...
Read more >
Customizing Application Modules Overriding Services
Replacing a service is possible for any type of class registered to the dependency injection, including services of the ABP Framework. You have...
Read more >
Dependency Injection failure using the ABP Framework
I am struggling with making the getResult method run correctly and resolving the associated error. I am unsure of what exactly is causing...
Read more >
Exception injecting IRepository<MyEntity,Guid> in an ABP ...
I am trying to write a utility console app that has MySQL database access. ... It is failing with an exception: Autofac.Core.
Read more >
Dependency Injection issue from Console Application ...
When the console application is run I get dependency injection error in this line in CoreModule PostInitiliaze method: IocManager.Resolve<ChatUserStateWatcher>() ...
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