/// <summary> /// Method run after all the properties have been set for this object. /// Responsible for actual proxy creation. /// </summary> public void AfterPropertiesSet() { _transactionInterceptor.AfterPropertiesSet(); if (_target == null) { throw new ArgumentException("'target' is required."); } ProxyFactory proxyFactory = new ProxyFactory(); if (_preInterceptors != null) { for (int i = 0; i < _preInterceptors.Length; i++) { proxyFactory.AddAdvisor(_advisorAdapterRegistry.Wrap(_preInterceptors[i])); } } if (_pointcut != null) { IAdvisor advice = new DefaultPointcutAdvisor(_pointcut, _transactionInterceptor); proxyFactory.AddAdvisor(advice); } else { proxyFactory.AddAdvisor(new TransactionAttributeSourceAdvisor(_transactionInterceptor)); } if (_postInterceptors != null) { for (int i = 0; i < _postInterceptors.Length; i++) { proxyFactory.AddAdvisor(_advisorAdapterRegistry.Wrap(_postInterceptors[i])); } } proxyFactory.CopyFrom(this); proxyFactory.TargetSource = createTargetSource(_target); if (_proxyInterfaces != null) { proxyFactory.Interfaces = _proxyInterfaces; } else if (!ProxyTargetType) { if (_target is ITargetSource) { throw new AopConfigException("Either 'ProxyInterfaces' or 'ProxyTargetType' is required " + "when using an ITargetSource as 'target'"); } proxyFactory.Interfaces = AopUtils.GetAllInterfaces(_target); } _proxy = proxyFactory.GetProxy(); }