Hi,
When using the RepositoryRecord templates it is not possible to insert a new record and then update a field:
RecordType r = new RecordType();
r.Field1 = "val1";
r.Field2 = "val2";
DB.Save(r);
r.Field2 = "new val 2";
DB.Save(r): // This will not update Field2 in the database
I think the problem is in RecordBase.cs line 311:
/// <summary>
/// Sets a value for a particular column in the record
/// </summary>
/// <param name="columnName">Name of the column, as defined in the database</param>
/// <param name="oValue">The value to set the type to</param>
public void SetColumnValue(string columnName, object oValue)
{
columnSettings = columnSettings ?? new TableSchema.TableColumnSettingCollection();
//add the column to the DirtyColumns
//if this instance has already been loaded
//and this is a change to existing values
if(IsLoaded && !IsNew) // Shouldn't this be: if(IsLoaded || !IsNew)
{
TableSchema.Table schema = GetSchema();
object oldValue = null;
string oldValueMsg = "NULL";
string newValueMsg = "NULL";
bool areEqualOrBothNull = false;
Regards,
Stefan