So, like the subject says I'm getting an error and I don't know why.  Based 
on the idea of this 
<http://kozmic.net/2010/03/11/advanced-castle-windsor-ndash-generic-typed-factories-auto-release-and-more/>
 page, 
I created a factory with a custom selector.  The good news is it works fine 
under normal circumstances, but when the factory is inside a class that 
"inside" the container (in this case an IStartable) I receive an 
InvalidCastExcpeiton when truing to use the factory.  I changed the return 
type of the factory to a dynamic for debugging and it looks like the proxy 
object is completely missing it's interface methods. 

*Factory Registration:*
container.Register(Component.For<IDomainEventHandlerFactory>().AsFactory(f 
=> f.SelectedWith<DomainEventSelector>()),
                   Classes.FromAssemblyInDirectory(new AssemblyFilter(
AssemblyInformation.GetExecutionPath()))
                          .BasedOn(typeof(IDomainEventHandler<>))
                          .WithServiceBase()
                          .Configure(c => c.LifestyleTransient()
                                           .Interceptors<
AutoReleaseHandlerInterceptor>()));

*Factory Interface:*
*public interface IDomainEventHandlerFactory*
    *{*
        *IDomainEventHandler<TDomainEvent>[] 
GetDomainEventHandlers<TDomainEvent>(TDomainEvent @event) where 
TDomainEvent : IDomainEvent;*
    *}*

*Exception Message:*

*{"Unable to cast object of type 
'Entree.Infrastructrue.DomainEvents.IDomainEventHandler`1[Entree.Domain.Events.PlaceHolder.PlaceHolderItemCreated][]'
 
to type 
'Entree.Infrastructrue.DomainEvents.IDomainEventHandler`1[Entree.Infrastructrue.DomainEvents.IDomainEvent][]'."}*

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to