[Test] public void invoke_Instance() { tmProxy.map_ReferencesToTmObjects(); tmProxy.get_Current <TM_StartUp>().assert_Null(); tmProxy.invoke_Instance(typeof(TM_StartUp), "get_Version", new object[] {}) // this will invoke store the TM_StartUp value in the TM_StartUp.Current static propery .assert_Not_Null() .assert_Is_Equal_To(typeof(TM_StartUp).assembly().version()); tmProxy.get_Current <TM_StartUp>().assert_Not_Null(); tmProxy.invoke_Instance <string>(typeof(TM_StartUp), "get_Version") // another way to invoke_Instance .assert_Not_Null() .assert_Is_Equal_To(typeof(TM_StartUp).assembly().version()); }
/// <summary> /// Invoke the <code>instanceMethod</code> on a newly created <code>targetType</code> object (i.e. its .ctor will be called first) /// /// The return value is casted to <code>TResult</code> (with <code> default(TResult)</code> returned if the types don't match /// </summary> /// <typeparam name="TResult"></typeparam> /// <param name="tmProxy"></param> /// <param name="targetType"></param> /// <param name="instanceMethod"></param> /// <param name="invocationParameters"></param> /// <returns></returns> public static TResult invoke_Instance <TResult>(this TM_Proxy tmProxy, Type targetType, string instanceMethod, params object[] invocationParameters) { return(tmProxy.invoke_Instance(targetType, instanceMethod, invocationParameters) .cast <TResult>()); }
//Server side caches public static TM_Proxy gui_ResetCache(this TM_Proxy tmProxy) { tmProxy.invoke_Instance(typeof(TM_WebServices), "resetCache"); return(tmProxy); }