/// <summary> /// Assigns input parameters. /// </summary> public static void SetInputParameters(this IDbParameterBinding binding, ref string text, object instance) { var attr = binding.Attributes; if (attr.IsInput) { string valueGetter() => binding.GetValue(instance).ToString(); DbHelper.SetSqlParameter(ref text, binding.SpParamName, valueGetter, attr.IsOptional); } }
/// <summary> /// Get output parameters. /// </summary> public static void GetOutputParameters(this IDbParameterBinding binding, DbCommand cmd, object instance) { var attr = binding.Attributes; if (attr.IsOutput) { try { binding.SetValue(instance, DbHelper.GetSqlParameter(cmd, binding.SpParamName)); } catch { if (!attr.IsOptional) { throw; } } } }