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

Error on dynamic interface registration #8538


User avatar
0
andmattia created

Hi

I've create a custom Interface and I try to register via Windsor but work fine for a lot of class reather then BackGroundJob. Below the code that I use

public class ImportJob : BackgroundJob<ImportJogArgs>, ITransientDependency, IExposedJob
    {
        public UserManager UserManager { get; set; }
        ...
   }
   
   // NOT REGISTER
   public class ExsposedJobConventionalRegistrar : IConventionalDependencyRegistrar
    {
        public void RegisterAssembly(IConventionalRegistrationContext context)
        {
            context.IocManager.IocContainer.Register(
                Classes.FromAssembly(context.Assembly)
                    .BasedOn<IExposedJob>()
                    .If(type => !type.GetTypeInfo().IsGenericTypeDefinition)
                    .WithService.Self()
                    .WithService.Base()
                    .WithService.AllInterfaces()
            );
        }
    }
   
   // MANUAL FORCE REGISTER
   // On module pre init
   IocManager.IocContainer.Register(
                Component.For<IExposedJob, ImportJob>().ImplementedBy<ImportJob>()
            );
            

I try to change from base class BackgroundJob to anithing else and works fine.


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Same question: https://support.aspnetzero.com/QA/Questions/8535

    Please discuss it in #8535