internal SprocResultWriter(DatabaseStoredProcedure storedProcedure, string ns, ClassBuilder classBuilder) { _namespace = ns; _storedProcedure = storedProcedure; _logic = new SprocLogic(_storedProcedure); _resultClassName = _logic.ResultClassName; _cb = classBuilder; }
public SprocResultWriter(DatabaseStoredProcedure storedProcedure, string ns) { _namespace = ns; _storedProcedure = storedProcedure; _logic = new SprocLogic(_storedProcedure); _resultClassName = _logic.ResultClassName; _cb = new ClassBuilder(); }
public SprocWriter(DatabaseStoredProcedure storedProcedure, string ns) { _namespace = ns; _storedProcedure = storedProcedure; _logic = new SprocLogic(_storedProcedure); _sprocResultType = _logic.ResultType; _cb = new ClassBuilder(); }
private void WriteArgument(DatabaseArgument argument) { _cb.AppendLine(""); _cb.AppendLine("//" + argument.Name + " " + argument.DatabaseDataType); string s = string.Format(CultureInfo.InvariantCulture, "AddWithValue(cmd, \"{0}\", {1});", argument.Name, SprocLogic.ArgumentCamelCaseName(argument)); if (!argument.Out) { //normal in parameters _cb.AppendLine(s); return; } // output and input-output parameters. var pName = "p" + argument.NetName; var isRefCursor = string.Equals("REF CURSOR", argument.DatabaseDataType, StringComparison.OrdinalIgnoreCase); if (argument.In) { //input output _cb.AppendLine("var " + pName + " = " + s); } else { //just output if (isRefCursor) { _cb.AppendLine("var " + pName + " = (OracleParameter)cmd.CreateParameter();"); } else { _cb.AppendLine("var " + pName + " = cmd.CreateParameter();"); } _cb.AppendLine(pName + ".ParameterName = \"" + argument.Name + "\";"); _cb.AppendLine("cmd.Parameters.Add(" + pName + ");"); } _cb.AppendLine(pName + ".Direction = ParameterDirection." + (argument.In ? "InputOutput" : "Output") + ";"); // you may need DbType on output parameters if (isRefCursor) { _cb.AppendLine(pName + ".OracleType = OracleType.Cursor;"); return; } var dt = argument.DataType; if (dt == null) { _cb.AppendLine(pName + ".DbType = DbType.Object;"); return; } var t = dt.GetNetType(); _cb.AppendLine(pName + ".DbType = DbType." + Type.GetTypeCode(t) + ";"); }