/// <summary> /// 插入一个实体 /// </summary> /// <param name="entity">要插入的实体</param> /// <param name="fillIdentity">是否填充主键</param> /// <returns></returns> public static object Insert(EntityBase entity, bool fillIdentity) { Type type = CH.GetRealType(entity); string name = type.FullName; object bo = DataAccessLoader.GetBoInstance(name); FastInvokeHandler inv = FastValueGetSet.GetCustomerMethodInfo(bo.GetType(), "Insert", new Type[] { type, typeof(bool) }); return(inv(bo, new object[] { entity, fillIdentity })); }
public void Init(HttpApplication context) { PropertyInfoHandle fileChangesMonitorGet = FastValueGetSet.GetPropertyInfoHandle("FileChangesMonitor", typeof(HttpRuntime)); object o = fileChangesMonitorGet.GetValue(null); GetFieldValueHandle f = FastFieldGetSet.FindGetValueHandle(o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)); object monitor = f(o); FastInvokeHandler m = FastValueGetSet.GetCustomerMethodInfo(monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic)); m.Invoke(monitor, new object[] { }); }
/// <summary> /// 设置控件的属性 /// </summary> /// <param name="ctr">要设置的控件</param> /// <param name="methodName">函数名</param> /// <param name="parametersType">参数类型</param> /// <param name="args">参数</param> public static object InvokeMethod(Control ctr, string methodName, Type[] parametersType, object[] args) { object ret = null; if (ctr.InvokeRequired) { DelInvokeMethod del = new DelInvokeMethod(InvokeMethod); ret = ctr.Parent.Invoke(del, new object[] { ctr, methodName, args }); } else { ret = FastValueGetSet.GetCustomerMethodInfo(ctr.GetType(), methodName, parametersType).Invoke(ctr, args); } return(ret); }
/// <summary> /// 运行该函数 /// </summary> /// <param name="methodName">函数名</param> /// <param name="args">参数</param> /// <returns></returns> public object Invoke(string methodName, params object[] args) { FastInvokeHandler fhandle = FastValueGetSet.GetCustomerMethodInfo(_classHandle.ClassType, methodName, GetParamTypes(args)); return(fhandle.Invoke(_instance, args)); }