Row added with Insert stored procedure does not update IsDirty


Author
Message
George Nentidis
George Nentidis
StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Hi there!

I try to modify the CRUD properties of a BO. The BO has a primary key of type Guid (uniqueidentifier in SQL Server) which I set its default value on the BO_SetDefaultValues event. I have set the PrimaryKeyIsAutoIncremented to False. I have set the InsertUsingStoredProcedure to True and also defined a stored procedure name in the InsertStoredProcedureName property. I have set the UpdateConcurrencyType to OptimisticsTimestamp and also defined a column name in the RowVersionOrTimestamp column. I have defined this column as an output parameter in the insert stored procedure.

I add a new row with the BO.Add method, edit some data in the form and then call the Save method. The row is added ok in the data base, but the IsDirty flag remains True. I can see in the CurrentDataTable that the row added with the BO.Add member has still a RowState of DataViewRowState.Added after the Save. I guess this is why IsDirty is True. Is this supposed to happen, or am I doing something wrong?

Thank you for your time.

George Nentidis

Replies
George Nentidis
George Nentidis
StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Also while working with transactions, I've seen that when saving a child object, this will also save its parent. But since in transactions the IsDirty flag is not touched, the parent object will be saved twice. For instance the following code:

    try {
        BusinessLayer.TransactionBegin("", IsolationLevel.ReadUncommitted);
        mContactBO.Save(true);
        mContactAddressesBO.Save(true);
        BusinessLayer.TransactionCommit("");
        }
    catch(Exception x) {
        BusinessLayer.TransactionRollback("");
        }

will actually call the update or insert stored procedure of the mContactBO twice. Which might cause problems in the case of insertion.

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The transaction rolls back fine, nothing is changed in the DB. When I try to save the changes again, the Save method of the BO gets into an infinite loop where the framework keeps calling my update stored procedure, and then a select statement.

Looks like a bug... I'm not sure we have a unit test to cover this scenario, so I'll have to step through it and verify. 

Also while working with transactions, I've seen that when saving a child object, this will also save its parent. But since in transactions the IsDirty flag is not touched, the parent object will be saved twice.

Yes, this is a known issue and will be fixed within the next official release.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
George,

Since I had a backup of your database, I restored it and then started testing the DDT import.  The reason all of your data types were incorrectly imported was due to the user-defined data types, which the DDT doesn't support. So I changed the import to test for this and instead of returning an Integer as the default, it actually extracts the underlying data type from the User-Defined definition so that the type actually comes into the DDT correctly.  This will be included in the post I put out there at the end of the day.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search