I use EasyObject20 to generate code from database Oracle. A few days ago, I've asked Matt for the sequence in Oracle, but...
First, when I apply the sequence by mask property SEQ:I, I found that in insert command, there are two parameters of primary key: first in
- Code: Select all
protected override DbCommand GetInsertCommand(CommandType commandType)
{
DbCommand dbCommand;
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = GetDatabase();
switch (commandType)
{
case CommandType.StoredProcedure:
string sqlCommand = this.SchemaStoredProcedureWithSeparator + "daab_AddV2_DATA_MESSAGE";
dbCommand = db.GetStoredProcCommand(sqlCommand);
db.AddParameter(dbCommand, "MESSAGEID", DbType.Decimal, 0, ParameterDirection.Output, true, 0, 0, "MESSAGEID", DataRowVersion.Default, Convert.DBNull);
CreateParameters(db, dbCommand);
return dbCommand;
case CommandType.Text:
...
default:
throw new ArgumentException("Invalid CommandType", "commandType");
}
}
and second in
- Code: Select all
private void CreateParameters(Database db, DbCommand dbCommand)
{
db.AddInParameter(dbCommand, "MESSAGEID", DbType.Decimal, "MESSAGEID", DataRowVersion.Current); // duplicate here
db.AddInParameter(dbCommand, "BODY", DbType.String, "BODY", DataRowVersion.Current);
db.AddInParameter(dbCommand, "CREATEDDATE", DbType.DateTime, "CREATEDDATE", DataRowVersion.Current);
db.AddInParameter(dbCommand, "CREATEDBY", DbType.String, "CREATEDBY", DataRowVersion.Current);
db.AddInParameter(dbCommand, "FLAG", DbType.AnsiStringFixedLength, "FLAG", DataRowVersion.Current);
}
Another bug is, when I remove the second parameter, build and run, the app alway throw exception: ORA-01401: inserted value too large for column (the store procedure I generated in oracle is tested ok)
How can I fix it?
