ModificationFunctionMapping bug?
Posted: Tue 21 Apr 2009 14:35
Hi,
I have a model that has a defining query and function mappings for all CRUD operations.
Select works great, but something isn't right in the update function.
My function's command text is quite complex but I've found there to be a problem even when using simple update statements.
Reproduction:
1. Construct a model
2. Replace Entity Set table's name with a defining query of "select * from table"
3. Create a function for the update statement and use a command text element to enter a simple "update table set column = :param1 where id = :id"
4. Apply appropriate modification function mappings
When trying to update I receive an error message : "Store update, insert, or delete statement affected an unexpected number of rows(0)..."
I'm quite sure the update should have worked, and just to make sure, I used some code found on the internet that allows reproducing command that EF sends to the DB. When I intercept that dbcommand and execute it myself using ExecuteNonQuery, it works just find and updates the row.
I've also tried to use RowsAffectedParameter and it didn't work either, and from what i've seen in the generated dbcommand, the RowsAffected parameter has a direction of input instead of output for some reason.
Can you please confirm there is a bug in using modification functions with commandText (rather than with stored procedures)?
I've tried this both on version 5.0.1 and 5.2.
Thanks in advance,
Ido Flatow.
I have a model that has a defining query and function mappings for all CRUD operations.
Select works great, but something isn't right in the update function.
My function's command text is quite complex but I've found there to be a problem even when using simple update statements.
Reproduction:
1. Construct a model
2. Replace Entity Set table's name with a defining query of "select * from table"
3. Create a function for the update statement and use a command text element to enter a simple "update table set column = :param1 where id = :id"
4. Apply appropriate modification function mappings
When trying to update I receive an error message : "Store update, insert, or delete statement affected an unexpected number of rows(0)..."
I'm quite sure the update should have worked, and just to make sure, I used some code found on the internet that allows reproducing command that EF sends to the DB. When I intercept that dbcommand and execute it myself using ExecuteNonQuery, it works just find and updates the row.
I've also tried to use RowsAffectedParameter and it didn't work either, and from what i've seen in the generated dbcommand, the RowsAffected parameter has a direction of input instead of output for some reason.
Can you please confirm there is a bug in using modification functions with commandText (rather than with stored procedures)?
I've tried this both on version 5.0.1 and 5.2.
Thanks in advance,
Ido Flatow.