I am using Castle Windsor v3.0.0.0 and am getting the following error when I
try to resolve a component from the container.

Castle.MicroKernel.ComponentActivator.NoResolvableConstructorFoundException
: Could not find resolvable constructor for EnvironmentValidationService.
Make sure all required dependencies are provided.


The registrations happen in an installer that we have written.

public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.SafeFacilityInstall<TypedFactoryFacility>();

var validators = from a in AppDomain.CurrentDomain.GetAssemblies()
                             from t in a.GetTypes()
                             where
typeof(IEnvironmentValidation).IsAssignableFrom(t)
                                && t.IsClass
                                && !t.IsAbstract
                             select t;

foreach (var type in validators) {
_log.DebugFormat("EnvironmentValidationInstaller found and registered
'{0}'", type.Name);
container.Register(Component.For<IEnvironmentValidation>().ImplementedBy(type).LifeStyle.Singleton);
}

container.Register(Component.For<IEnvironmentValidationFactory>().AsFactory());
container.Register(Component.For<EnvironmentValidationExecutor>());
container.Register(Component.For<EnvironmentValidationService>());


var service = container.Resolve<EnvironmentValidationService>();
service.Start();
}

The code throwing the error is in the above installer

var service = container.Resolve<EnvironmentValidationService>();


The definition of those 3 types are as follows

    public class EnvironmentValidationService : DelayableTimer, IDisposable
    {

        private static readonly TimeSpan seconds_30 = 30.Seconds();
        private static readonly TimeSpan hour_1 = 1.Hours();

        private EnvironmentValidationExecutor _executor;

        public EnvironmentValidationService(EnvironmentValidationExecutor
exe, int minutesBetweenChecks)
            : base(seconds_30, minutesBetweenChecks.Minutes())
        { ... }

        public EnvironmentValidationService(EnvironmentValidationExecutor
exe)
            : base(seconds_30, hour_1)
        { ... }
    }

    public class EnvironmentValidationExecutor
    {
        private IEnvironmentValidationFactory _factory;

        public EnvironmentValidationExecutor(IEnvironmentValidationFactory
factory)
        { ... }
    }

    public interface IEnvironmentValidationFactory
    {
        IEnumerable<IEnvironmentValidation> GetValidators();

        void Release(IEnvironmentValidation validation);
    }

I'm not sure why I'm getting the errors. Since I can resolve the
EnvironmentValidationExecutor and the IEnvironmentValidationFactory, I would
assume that the container could resolve them in order to use the second
constructor on the EnvironmentValidationService. Any help would be
appreciated.


Matthew Brubaker
[email protected]
(785) 215-7061

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to