Hi
I had a custom interface to register on Windsor but not work.
I add this interface to BackGroudJob
public interface IExposedJob{
...}
public class Job1Job : BackgroundJob<Job1Args>, IExposedJob, ITransientDependency
{....
}
// Manual WORK
IocManager.IocContainer.Register(
Component.For<IExposedJob, Job1>().ImplementedBy<Job1>(),
Component.For<IExposedJob, Job2>().ImplementedBy<Job2>()
);
// Auto not WORK
context.IocManager.IocContainer.Register(
Classes.FromAssembly(context.Assembly)
.BasedOn<IExposedJob>()
.If(type => !type.GetTypeInfo().IsGenericTypeDefinition)
.WithService.Self()
.WithService.Base()
.WithService.AllInterfaces()
);
6 Answer(s)
-
0
hi andmattia
You've found the solution, right?
// Manual WORK IocManager.IocContainer.Register( Component.For<IExposedJob, Job1>().ImplementedBy<Job1>(), Component.For<IExposedJob, Job2>().ImplementedBy<Job2>() );
For Windsor please check https://github.com/castleproject/Windsor/tree/master/docs
-
0
No
I found a problem but it is manual. The strange situation is that everything works except and when the class inherits from BackGround Job
-
0
What is the error?
-
0
I don't have an error but if i try to search the interface it isn't registered.
-
1
I suppose it is run after
RegisterAssemblyByConvention
in your module.For compatibility<sup>1</sup> with
RegisterAssemblyByConvention
, configure a unique name.<sup>1</sup> If your concrete class implements ASP<span></span>.NET Boilerplate's
ITransientDependency
, then the default name is used to register the class for.WithService.Self()
insideRegisterAssemblyByConvention
.context.IocManager.IocContainer.Register( Classes.FromAssembly(context.Assembly) .BasedOn<IExposedJob>() .If(type => !type.GetTypeInfo().IsGenericTypeDefinition) .WithService.Self() .WithService.Base() .WithService.AllInterfaces() + .Configure(configurer => configurer.Named(Guid.NewGuid().ToString())) );
-
0
Hi @aaron
it works!
Thanks a lot for your support!