Exemplo n.º 1
0
		public void CollectElementsToProxy(IProxyGenerationHook hook, MetaType model)
		{
			foreach (var collector in CollectElementsToProxyInternal(hook))
			{
				foreach (var method in collector.Methods)
				{
					model.AddMethod(method);
					methods.Add(method);
				}
				foreach (var @event in collector.Events)
				{
					model.AddEvent(@event);
					events.Add(@event);
				}
				foreach (var property in collector.Properties)
				{
					model.AddProperty(property);
					properties.Add(property);
				}
			}
		}
		public void CollectElementsToProxy(IProxyGenerationHook hook, MetaType model)
		{
			foreach (var collector in CollectElementsToProxyInternal(hook))
			{
				foreach (var method in collector.Methods)
				{
                    if (!IsInterceptable(collector, method.Method))
                        continue;

					model.AddMethod(method);
					methods.Add(method);
				}
				foreach (var @event in collector.Events)
                {
                    if (!IsInterceptable(collector, @event.Event))
                        continue;

					model.AddEvent(@event);
					events.Add(@event);
				}
				foreach (var property in collector.Properties)
                {
                    if (!IsInterceptable(collector, property.Property))
                        continue;

					model.AddProperty(property);
					properties.Add(property);

                    foreach (var method in collector.Methods
                        .Where(m => (property.CanRead && m.Method == property.GetMethod) || (property.CanWrite && m.Method == property.SetMethod)))
                    {
                        model.AddMethod(method);
                        methods.Add(method);
                    }
				}
			}
		}