public object __exit__(CodeContext context, object exc_type, object exc_value, object exc_tb) { DynamicOperations ops = context.LanguageContext.Operations; if (exc_type == null && exc_value == null && exc_tb == null) { object commitfn; if (ops.TryGetMember(this, "commit", out commitfn)) { ops.Invoke(commitfn); } else { commit(); } } else { object rollbackfn; if (ops.TryGetMember(this, "rollback", out rollbackfn)) { ops.Invoke(rollbackfn); } else { rollback(); } } return(false); }
/// <summary> /// Invokes the provided object with the given parameters and returns the result. /// /// The prefered way of calling objects is to convert the object to a strongly typed delegate /// using the ConvertTo methods and then invoking that delegate. /// </summary> public dynamic Invoke(object obj, params object[] parameters) { return(_ops.Invoke(obj, parameters)); }
/// <summary> /// Calls the provided object with the given parameters and returns the result. /// /// The prefered way of calling objects is to convert the object to a strongly typed delegate /// using the ConvertTo methods and then invoking that delegate. /// </summary> public object Call(object obj, params object[] parameters) { return(_ops.Invoke(obj, parameters)); }