I've these services and interfaces:
public interface IPresenterBase
{
//some stuff
}
public interface IHandler<T>
{
Handle(T...)
}
public abstract class PresenterBase { }
public abstract class CrudPresenter<TEntity> : PresenterBase,
IHandler<AddEntityEvent<TEntity>>, IHandler<EditEntityEvent<TEntity>>,
IHandler<DeleteEntityEvent<TEntity>>{}
and i have some implementations as follows:
public class EditCustomerPresenter : CrudPresenter<Customer> { .. }
and:
public class BrowseCustomerPresenter : PresenterBase ...
So, I want to register every Presenter as his own type (WithService.Self() )
and if they implement some ihandler, on any hierarchy level, i want to
register as handler of such thing too.
I did this:
container.Register(AllTypes.FromAssemblyContaining<IPresenterBase>()
.BasedOn(typeof(IHandler<>)).WithService.Base()
.WithService.Self()
.BasedOn<IPresenterBase>().WithService.Self()
.Configure(c => c.LifeStyle.Transient.OnCreate(InitializePresenter)));
This what i get:
container.Resolve<AddEntityEvent<Customer>>() // works
container.Resolve<EditEntityEvent<Customer>>() // works
container.ResolveAll<AddEntityEvent<Customer>>() // WORKS!
container.ResolveAll<EditEntityEvent<Customer>>() // throws exception inside
castle:
Message:
Object reference not set to an instance of an object.
Stack trace:
at
Castle.MicroKernel.Handlers.ForwardingHandler.IsBeingResolvedInContext(CreationContext
context)
at Castle.MicroKernel.DefaultKernel.ResolveAll(Type service, IDictionary
arguments)
at Castle.MicroKernel.DefaultKernel.ResolveAll(Type service)
at Castle.Windsor.WindsorContainer.ResolveAll(Type service)
at Castle.Windsor.WindsorContainer.ResolveAll[T]()
This was working OK before we update to Windsor 2.5.1.0
thanks in advance.
--
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.