public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (_interceptorType == null && _interceptType == 0)
				return false;

			foreach (var builder in builders)
			{
				var interceptor = builder as InterceptorAspectBuilder;

				if (interceptor != null)
				{
					if (interceptor._interceptorType == null && interceptor._interceptType == 0)
						return false;

					if (builder == this)
						break;
				}
			}

			if (context.IsMethodOrProperty) switch (context.Step)
			{
				case BuildStep.Begin:   return true;
				case BuildStep.Before:  return (_interceptType & InterceptType.BeforeCall) != 0;
				case BuildStep.After:   return (_interceptType & InterceptType.AfterCall)  != 0;
				case BuildStep.Catch:   return (_interceptType & InterceptType.OnCatch)    != 0;
				case BuildStep.Finally: return (_interceptType & InterceptType.OnFinally)  != 0;
				case BuildStep.End:     return true;
			}

			return false;
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (context.IsBuildStep)
			{
				if (context.IsAbstractMethod)
				{
					// Give up if there is any builder that builds the method body.
					//
					if (builders.Count > 1)
						foreach (IAbstractTypeBuilder builder in builders)
							if (builder != this && builder.IsApplied(context, builders))
								return false;

					return true;
				}

				// Treat an abstract getter/setter as a regular method
				// when the property has [NoInstance] attribute 
				//
				if (context.IsAbstractGetter || context.IsAbstractSetter)
					return context.CurrentProperty.IsDefined(typeof(NoInstanceAttribute), true);
			}

			return false;
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (context == null) throw new ArgumentNullException("context");

			return
				base.IsApplied(context, builders) &&
				context.CurrentProperty != null &&
				context.CurrentProperty.GetIndexParameters().Length == 0 &&
				(PropertyType == null ||
				 TypeHelper.IsSameOrParent(PropertyType, context.CurrentProperty.PropertyType));
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (context == null) throw new ArgumentNullException("context");

			if (context.IsAbstractProperty && context.IsBeforeOrBuildStep)
			{
				return context.CurrentProperty.GetIndexParameters().Length <= 1;
			}

			return context.BuildElement == BuildElement.Type && context.IsAfterStep;
		}
		public override bool IsCompatible(BuildContext context, IAbstractTypeBuilder typeBuilder)
		{
			if (context.IsBuildStep)
				return false;

			var list = new AbstractTypeBuilderList(2) { this, typeBuilder };
			var step = context.Step;

			try
			{
				context.Step = BuildStep.Build;

				return typeBuilder.IsApplied(context, list);
			}
			finally
			{
				context.Step = step;
			}
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			return context.BuildElement == BuildElement.InterfaceMethod;
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			return context.IsAfterStep && context.BuildElement == BuildElement.Type == TargetElement is TypeHelper;
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (context == null) throw new ArgumentNullException("context");

			return context.IsBuildStep && context.BuildElement == BuildElement.AbstractMethod;
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (context == null) throw new ArgumentNullException("context");

			return context.IsFinallyStep && context.IsMethodOrProperty;
		}
			public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
			{
				return context.IsVirtualMethod && context.Step == BuildStep.After;
			}
		public virtual bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			return false;
		}
Beispiel #12
0
 public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
 {
     return(context.BuildElement == BuildElement.InterfaceMethod);
 }
 public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
 {
     return(context.IsBuildStep && context.IsAbstractMethod);
 }
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (context == null) throw new ArgumentNullException("context");

			return context.IsSetter && (context.IsBeforeStep || context.IsAfterStep);
		}
		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			return context.IsBuildStep && context.IsAbstractMethod;
		}
Beispiel #16
0
 public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
 {
     return(context.IsVirtualMethod && context.Step == BuildStep.After);
 }