コード例 #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);
        }
コード例 #2
0
 protected override IInterceptor CreateInterceptor(DecoratorContext context)
 {
     return new GriffinInterceptionLogger();
 }
コード例 #3
0
 /// <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();
 }