Hi,

I've tried updating my current work project to the new release and
found that everywhere I use the FactorySupportFacility my code breaks
in interesting ways. Basically it's a single FacilityException that
pops up.

Here's a simplified use-case:

Component.For<Configuration>()
    .LifeStyle.Singleton
    .UsingFactoryMethod(() => new Configuration(...))

Component.For<IUseTheConfiguration>()
    .ImplementedBy<UsesConfiguration>()

public class UsesConfiguration : IUseTheConfiguration
{
    public UsesConfiguration(Configuration config)
    { ... }
}

When I resolve an instance of IUseTheConfiguration the factory method
is first called from a GenericFactory<Configuration> that Windsor
provides. (I've set a breakpoint.)

After the Configuration instance is created Windsor throws an
exception:
Factory '<some guid>' (method 'TheNamespace.Configuration Create()')
created instance of type TheNamespace.Configuration.
This type is not compatible with implementation type
TheNamespace.UsesConfiguration registered for this component
(TheNamespace.UsesConfiguration).
This may signify a bug. If it's the expected behavior, change the
registration of this component to cover this return type.

The exception is thrown from FactoryActivator.Instantiate(), actually
at the latest possible point before returning the factored
Configuration instance. I suspect it is typeof
(UsesConfiguration).IsInstanceOfType(Configuration) that returns
false.

Any ideas what's wrong with my code?

Thanks,
Alex
-- 
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