示例#1
0
        public object CreateClassProxy(Type classType, AspectDefinition aspect, params object[] constructorArgs)
        {
            AssertUtil.ArgumentNotNull(classType, "classType");
            AssertUtil.ArgumentNotNull(aspect, "aspect");

            IInvocationDispatcher dispatcher = _dispatcherFactory.Create(aspect, _engine);

            return(CreateAndInstantiateClassProxy(classType, aspect, dispatcher, constructorArgs));
        }
示例#2
0
		public void SetInterceptedComponentModel(ComponentModel target)
		{
			AspectDefinition aspectDef = (AspectDefinition) 
				target.ExtendedProperties["aop.aspect"];

			System.Diagnostics.Debug.Assert( aspectDef != null );

			_dispatcher = new ContainerInvocationDispatcher(aspectDef, _kernel);
			_dispatcher.Init(_engine);
		}
示例#3
0
        public object CreateInterfaceProxy(Type inter, object target, AspectDefinition aspect)
        {
            AssertUtil.ArgumentNotNull(inter, "inter");
            AssertUtil.ArgumentNotNull(target, "target");
            AssertUtil.ArgumentNotNull(aspect, "aspect");

            IInvocationDispatcher dispatcher = _dispatcherFactory.Create(aspect, _engine);

            return(CreateAndInstantiateInterfaceProxy(inter, target, aspect, dispatcher));
        }
示例#4
0
        public void SetInterceptedComponentModel(ComponentModel target)
        {
            AspectDefinition aspectDef = (AspectDefinition)
                                         target.ExtendedProperties["aop.aspect"];

            System.Diagnostics.Debug.Assert(aspectDef != null);

            _dispatcher = new ContainerInvocationDispatcher(aspectDef, _kernel);
            _dispatcher.Init(_engine);
        }
示例#5
0
        private object CreateClassProxyInstance(Type proxyType, object[] mixins, IInvocationDispatcher dispatcher, params object[] constructorArgs)
        {
            object proxy;

            if (mixins.Length != 0)
            {
                proxy = Activator.CreateInstance(proxyType, Merge(new object[] { dispatcher, mixins }, constructorArgs));
            }
            else
            {
                proxy = Activator.CreateInstance(proxyType, Merge(new object[] { dispatcher }, constructorArgs));
            }

            return(proxy);
        }
示例#6
0
		private object CreateInterfaceProxyInstance(Type proxyType, object target, object[] mixins, IInvocationDispatcher dispatcher)
		{
			object proxy;

			if (mixins.Length != 0)
			{
				proxy = Activator.CreateInstance(proxyType, new object[] {dispatcher, target, mixins});
			}
			else
			{
				proxy = Activator.CreateInstance(proxyType, new object[] {dispatcher, target});
			}

			return proxy;
		}
示例#7
0
		private object CreateClassProxyInstance(Type proxyType, object[] mixins, IInvocationDispatcher dispatcher, params object[] constructorArgs)
		{
			object proxy;

			if (mixins.Length != 0)
			{
				proxy = Activator.CreateInstance(proxyType, Merge(new object[] {dispatcher, mixins}, constructorArgs));
			}
			else
			{
				proxy = Activator.CreateInstance(proxyType, Merge(new object[] {dispatcher}, constructorArgs));
			}

			return proxy;
		}
示例#8
0
		private object ObtainInterfaceProxyInstance(AspectDefinition aspect, object target, Type inter, object[] mixins, IInvocationDispatcher dispatcher)
		{
			Type proxyType = GetProxyTypeFromCache(aspect, target.GetType());

			if (proxyType != null)
			{
				return CreateInterfaceProxyInstance(proxyType, target, mixins, dispatcher);
			}

			object proxy = _generator.CreateProxy(inter, target, mixins, dispatcher);
			RegisterProxyTypeInCache(aspect, target.GetType(), proxy.GetType());
			return proxy;
		}
示例#9
0
		private object ObtainClassProxyInstance(AspectDefinition aspect, Type baseClass, object[] mixins, IInvocationDispatcher dispatcher, params object[] constructorArgs)
		{
			Type proxyType = GetProxyTypeFromCache(aspect, baseClass);

			if (proxyType != null)
			{
				return CreateClassProxyInstance(proxyType, mixins, dispatcher, constructorArgs);
			}

			object proxy = _generator.CreateClassProxy(baseClass, mixins, dispatcher, constructorArgs);
			RegisterProxyTypeInCache(aspect, baseClass, proxy.GetType());
			return proxy;
		}
示例#10
0
 public DispatchingCallHandler(IInvocationDispatcher dispatcher)
 {
     Contract.Assert(dispatcher != null);
     _dispatcher = dispatcher;
 }
示例#11
0
        private object ObtainInterfaceProxyInstance(AspectDefinition aspect, object target, Type inter, object[] mixins, IInvocationDispatcher dispatcher)
        {
            Type proxyType = GetProxyTypeFromCache(aspect, target.GetType());

            if (proxyType != null)
            {
                return(CreateInterfaceProxyInstance(proxyType, target, mixins, dispatcher));
            }

            object proxy = _generator.CreateProxy(inter, target, mixins, dispatcher);

            RegisterProxyTypeInCache(aspect, target.GetType(), proxy.GetType());
            return(proxy);
        }
示例#12
0
        protected virtual object CreateAndInstantiateInterfaceProxy(Type inter, object target, AspectDefinition aspect, IInvocationDispatcher dispatcher, params object[] constructorArgs)
        {
            object proxy = null;

            object[] mixins = InstantiateMixins(aspect.Mixins);
            proxy = ObtainInterfaceProxyInstance(aspect, target, inter, mixins, dispatcher);
            InitializeMixins(proxy, mixins);

            return(proxy);
        }
示例#13
0
        protected virtual object CreateAndInstantiateClassProxy(Type baseClass, AspectDefinition aspect, IInvocationDispatcher dispatcher, params object[] constructorArgs)
        {
            object proxy = null;

            object[] mixins = InstantiateMixins(aspect.Mixins);
            proxy = ObtainClassProxyInstance(aspect, baseClass, mixins, dispatcher, constructorArgs);
            InitializeMixins(proxy, mixins);

            return(proxy);
        }
示例#14
0
        private object CreateInterfaceProxyInstance(Type proxyType, object target, object[] mixins, IInvocationDispatcher dispatcher)
        {
            object proxy;

            if (mixins.Length != 0)
            {
                proxy = Activator.CreateInstance(proxyType, new object[] { dispatcher, target, mixins });
            }
            else
            {
                proxy = Activator.CreateInstance(proxyType, new object[] { dispatcher, target });
            }

            return(proxy);
        }
示例#15
0
		protected virtual object CreateAndInstantiateClassProxy(Type baseClass, AspectDefinition aspect, IInvocationDispatcher dispatcher, params object[] constructorArgs)
		{
			object proxy = null;

			object[] mixins = InstantiateMixins(aspect.Mixins);
			proxy = ObtainClassProxyInstance(aspect, baseClass, mixins, dispatcher, constructorArgs);
			InitializeMixins(proxy, mixins);

			return proxy;
		}
示例#16
0
		protected virtual object CreateAndInstantiateInterfaceProxy(Type inter, object target, AspectDefinition aspect, IInvocationDispatcher dispatcher, params object[] constructorArgs)
		{
			object proxy = null;

			object[] mixins = InstantiateMixins(aspect.Mixins);
			proxy = ObtainInterfaceProxyInstance(aspect, target, inter, mixins, dispatcher);
			InitializeMixins(proxy, mixins);

			return proxy;
		}
示例#17
0
        private object ObtainClassProxyInstance(AspectDefinition aspect, Type baseClass, object[] mixins, IInvocationDispatcher dispatcher, params object[] constructorArgs)
        {
            Type proxyType = GetProxyTypeFromCache(aspect, baseClass);

            if (proxyType != null)
            {
                return(CreateClassProxyInstance(proxyType, mixins, dispatcher, constructorArgs));
            }

            object proxy = _generator.CreateClassProxy(baseClass, mixins, dispatcher, constructorArgs);

            RegisterProxyTypeInCache(aspect, baseClass, proxy.GetType());
            return(proxy);
        }