public void OnComponentCreated(ContractIdentity identity, IComponentFactory componentFactory, Type componentTargetType,
                                       ref object componentInstance, object originalInstance)
        {
            var match = false;

            if (IncludedContracts != null)
            {
                match |= IncludedContracts.Match(identity.Type);
            }

            if (!match)
            {
                return;
            }

            if (!identity.Type.IsInterface)
            {
                throw new ArgumentException(
                          "Can not create wrapper for non-interface type contracts. " +
                          "The transaction composition listener should be configured such that " +
                          "the non-interface type contracts do not match the wrapping criteria.");
            }


            var interceptor = new TracingInterceptor(identity.Type.Name);
            var callHanlder = new InterceptingAdapterEmittedTypeHanlder(componentInstance, interceptor);

            componentInstance = ClassEmitter.EmitInterfaceInstance(callHanlder, identity.Type);
        }
Beispiel #2
0
        public void OnComponentRetrieved(ContractIdentity identity, IComponentFactory componentFactory, Type componentTargetType, ref object componentInstance, object originalInstance)
        {
            if (IncludedContracts != null)
            {
                if (!IncludedContracts.Match(identity.Type))
                {
                    return;
                }
            }

            if (IncludedComponents != null)
            {
                if (!IncludedComponents.Match(componentTargetType))
                {
                    return;
                }
            }

            OnComponentRetrievedCount++;
        }
Beispiel #3
0
        public void OnComponentComposed(ContractIdentity identity, IEnumerable <InitializationPointSpecification> initializationPoints, IEnumerable <object> initializationPointResults, Type componentTargetType, object componentInstance, object originalInstance)
        {
            if (IncludedContracts != null)
            {
                if (!IncludedContracts.Match(identity.Type))
                {
                    return;
                }
            }

            if (IncludedComponents != null)
            {
                if (!IncludedComponents.Match(componentTargetType))
                {
                    return;
                }
            }

            OnComponentComposedCount++;
        }