/// <summary> /// 在作用域下执行 /// </summary> /// <param name="instanceType">实例类型</param> /// <param name="instance">The instance.</param> /// <param name="scope">执行代码作用区间</param> public override bool InvokeInScope(Type instanceType, object instance, ModuleRunScope scope = null) { if (!string.IsNullOrEmpty(StaticType)) { instanceType = TypeCache.GetRuntimeType(StaticType); Flags |= BindingFlags.Static; instance = null; } FieldInfo mInfo = instanceType.GetField(Name, Flags); if (mInfo == null) { throw new System.Configuration.ConfigurationErrorsException("字段[" + Name + "]在类型(" + instanceType.FullName + ")中未找到,请确保系统配置(flags)正确!"); } else { if ((Flags & BindingFlags.SetField) == BindingFlags.SetField) { mInfo.SetValue(instance, ValueType.GetObjectValue()); } if ((Flags & BindingFlags.GetField) == BindingFlags.GetField) { scope.StepSwap = mInfo.GetValue(instance); } } return(false); }