protected override void FillRoutineParams(DBSchemaRoutine aroutine, DataTable dtSprocParams) { DataColumn pos = GetColumn(dtSprocParams, "POSITION", true); DataColumn direction = GetColumn(dtSprocParams, "IN_OUT", true); DataColumn isResult = GetColumn(dtSprocParams, "IS_RESULT", false); DataColumn name = GetColumn(dtSprocParams, "ARGUMENT_NAME", true); DataColumn type = GetColumn(dtSprocParams, "DATA_TYPE", true); DataColumn strSize = GetColumn(dtSprocParams, "CHARACTER_LENGTH", false); DataColumn CharacterSetColumn = GetColumn(dtSprocParams, "CHARACTER_SET_NAME", false); foreach (DataRow row in dtSprocParams.Rows) { DBSchemaParameter param = new DBSchemaParameter(); param.NativeName = GetColumnStringValue(row, name); param.InvariantName = GetInvariantParameterName(param.NativeName); param.ParameterIndex = GetColumnIntValue(row, pos, -1); string dirvalue = GetColumnStringValue(row, direction); param.Direction = GetParameterDirectionFromSchemaValue(dirvalue); if (GetColumnBoolValue(row, isResult)) { param.Direction = ParameterDirection.ReturnValue; } param.NativeType = GetColumnStringValue(row, type); param.DbType = GetDbTypeForNativeType(param.NativeType, GetColumnStringValue(row, CharacterSetColumn)); param.RuntimeType = GetSystemTypeForNativeType(GetColumnStringValue(row, type)); param.ParameterSize = GetColumnIntValue(row, strSize, -1); aroutine.Parameters.Add(param); } }
private void GenerateRoutineParameters(DBSchemaRoutine schemaRoutine, bool annotateDirection) { if (schemaRoutine.Parameters != null && schemaRoutine.Parameters.Count > 0) { List <DBSchemaParameter> param = this.SortColumnsByOrdinal(schemaRoutine.Parameters); this.BeginBlock(); for (int i = 0; i < param.Count; i++) { this.BeginNewLine(); DBSchemaParameter p = param[i]; if (annotateDirection) { switch (p.Direction) { case System.Data.ParameterDirection.Input: this.WriteRawSQLString("IN "); break; case System.Data.ParameterDirection.InputOutput: this.WriteRawSQLString("INOUT "); break; case System.Data.ParameterDirection.Output: this.WriteRawSQLString("OUT "); break; case System.Data.ParameterDirection.ReturnValue: //Skip the return parameters continue; default: throw new ArgumentOutOfRangeException("DBSchemaParameter.Direction"); } } this.WriteNativeParameterReference(p.InvariantName); this.WriteSpace(); string options; string type = this.GetNativeTypeForDbType(p.DbType, p.ParameterSize, -1, DBColumnFlags.Nullable, out options); this.WriteRawSQLString(type); if (string.IsNullOrEmpty(options) == false) { this.WriteRawSQLString(options); } if (i < param.Count - 1) { this.WriteReferenceSeparator(); } } this.EndBlock(); } this.BeginNewLine(); }