public static SqlServerStoredProcedure SqlServerStoredProcedureCollectionToStoreProcedure(DataRow sqlServerStoredProcedure, DataTable sqlServerParametersColletions) { SqlServerStoredProcedure storedProcedure = new SqlServerStoredProcedure(); storedProcedure.Name = sqlServerStoredProcedure["routine_name"].ToString(); foreach (DataRow row in sqlServerParametersColletions.Rows) { SqlServerParameter parameter = new SqlServerParameter(); parameter.DBName = row["parameter_name"].ToString(); parameter.Direction = SqlServerTranslatorHelper.GetDirection(row["parameter_mode"].ToString()); SqlServerDbDataType dbDataType = new SqlServerDbDataType(); dbDataType.ProviderType = SqlServerDataTypeConverter.String2DatabaseType(row["data_type"].ToString()); dbDataType.Type = SqlServerDataTypeConverter.DatabaseType2NetType(dbDataType.ProviderType); dbDataType.Precision = SqlServerTranslatorHelper.GetPrecision(row["numeric_precision"]); dbDataType.Scale = SqlServerTranslatorHelper.GetScale(row["numeric_scale"]); dbDataType.Size = SqlServerTranslatorHelper.GetParameterSize(dbDataType.ProviderType, row); parameter.DbDataType = dbDataType; storedProcedure.Parameters.Add(parameter); } return(storedProcedure); }
public static SqlServerStoredProcedure SqlServerStoredProcedureCollectionToStoreProcedure(DataRow sqlServerStoredProcedure, DataTable sqlServerParametersColletions) { SqlServerStoredProcedure storedProcedure = new SqlServerStoredProcedure(); storedProcedure.Name = sqlServerStoredProcedure["routine_name"].ToString(); foreach(DataRow row in sqlServerParametersColletions.Rows) { SqlServerParameter parameter = new SqlServerParameter(); parameter.DBName = row["parameter_name"].ToString(); parameter.Direction = SqlServerTranslatorHelper.GetDirection(row["parameter_mode"].ToString()); SqlServerDbDataType dbDataType = new SqlServerDbDataType(); dbDataType.ProviderType = SqlServerDataTypeConverter.String2DatabaseType(row["data_type"].ToString()); dbDataType.Type = SqlServerDataTypeConverter.DatabaseType2NetType(dbDataType.ProviderType); dbDataType.Precision = SqlServerTranslatorHelper.GetPrecision(row["numeric_precision"]); dbDataType.Scale = SqlServerTranslatorHelper.GetScale(row["numeric_scale"]); dbDataType.Size = SqlServerTranslatorHelper.GetParameterSize(dbDataType.ProviderType, row); parameter.DbDataType = dbDataType; storedProcedure.Parameters.Add(parameter); } return storedProcedure; }