What steps will reproduce the problem? 1. Generate ActiveRecord and Controller classes for a table (used Sonic.exe generateTables and generateODS)
Bind an object datasource to the controller
Perform an update via FormView/GridView
What is the expected output? What do you see instead?
If changes were made, one would assume the record would be updated... but upon examining the update method that is generated, it's easy to see why it's not. Also this causes me to have the SQL error "near WHERE" thrown due to the SET criteria not being populated.
The generated method is as follows (Where Id is my primary key):
public void Update(Guid Id, Type column1, Type column2 ...)
{
ActiveRecordType item = new ActiveRecordType();
item.column1 = column1;
item.column2 = column2;
...
item.MarkOld();
item.Save(Username);
}
This doesnt populate the SET criteria of the update statement, because while it is marked with IsDirty == true, it doesnt have any DirtyColumns.
What version of the product are you using? On what operating system?
2.1 Final on XP
Please provide any additional information below.
My Fix:
public void Update(Guid Id, Type column1, Type column2 ...)
{
ActiveRecordType item = ActiveRecordType.FetchByID(Id);
item.MarkOld();
item.column1 = column1;
item.column2 = column2;
...
item.Save(Username);
}
Comment #1
Posted on Apr 8, 2009 by Happy DogI don't follow - setting as Won't Fix unless there's a bug report - this sounds more like a critique (which is fine - this isn't the forum for it).
If you have an error can you please show me how to repro? Thank you...
Comment #2
Posted on Apr 8, 2009 by Helpful HippoThe bug here is that in the ODS update method, columns that are set to their default value won't be set as dirty because according to the state of the object it isn't a different value and therefore not added to the dirty columns list.
To reproduce: create an ODS from a table with a PK and a bool not null column called "Active". the table should have a row with 1 as the PK, and true for Active.
ODSTestController ods = new ODSTestController(); ods.Update(1, false); // fails ods.Update(1, true); // succeeds
Status: WontFix
Labels:
Type-Defect
Priority-Medium