http://stw.castleproject.org/Windsor.Decorators.ashx
http://ayende.com/Blog/archive/2008/10/05/windsor-ihandlerselector.aspx

On 3/8/2010 6:47 PM, joniba wrote:
Hi Krzysztof, how would implementing the IHandlerSelector help me? How
will I differentiate between the initial call to (continuing the
example)

container.Resolve<IWriteRepository<Document>>()

With castle windsor's internal attempt to resolve the
SecurityRepositoryDecorator's "inner" parameter?


Thanks
Joni


On Mar 8, 7:17 pm, Krzysztof Koźmic<[email protected]>
wrote:
use IHandlerSelector

On 3/8/2010 5:59 PM, joniba wrote:

Hi all, I'm trying to use Castle Windsor to implement decorator
chains, as per Ayende's msdn post. However, I'm using the fluent API,
and I want to know if it can be done en masse.
Without the decorators I have:
container.Register
                  (
                      AllTypes.FromAssembly(assembly)
                      .IncludeNonPublicTypes()
                      .BasedOn(typeof(IWriteRepository<>)).WithService.Base()
                      .Configure(component =>
component.LifeStyle.Transient)
                  );
(Which works fine.)
My decorators also implement IWriteRepository<T>, and take as the
inner, an IWriteRepository<T>. For example:
public class SecurityRepositoryDecorator<TEntity>    :
IWriteRepository<TEntity>
      {
          private IWriteRepository<TEntity>    inner;
          public SecurityRepositoryDecorator(IWriteRepository<TEntity>
inner)
          {
              this.inner = inner;
          }
      }
Is this impossible because of a circular reference to
IWriteRepository<>?
I would like to get to:
var repository = container.Resolve<IWriteRepository<Document>>();
And have this return a SecurityRepositoryDecorator wrapping a
DocumentRepository.
Any ideas are appreciated.
Joni

--
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