示例#1
0
        object ICreateCallback.InstanceCreated(CreateContext context, IBuildPlan buildPlan, object instance)
        {
            if (_decorators.Count == 0)
            {
                return(instance);
            }

            var ctx = new DecoratorContext(buildPlan.Services, buildPlan.Lifetime)
            {
                Instance = instance, RequestedService = context.RequestedService
            };

            foreach (var decorator in _decorators)
            {
                decorator.Decorate(ctx);
            }

            return(ctx.Instance);
        }
 protected override IInterceptor CreateInterceptor(DecoratorContext context)
 {
     return new GriffinInterceptionLogger();
 }
 /// <summary>
 /// Create a new interceptor
 /// </summary>
 /// <param name="context">The context.</param>
 /// <returns>
 /// Created interceptor (which will be used to handle the instance)
 /// </returns>
 protected override IInterceptor CreateInterceptor(DecoratorContext context)
 {
     return new LoggingInterceptor();
 }