ModificationFunctionMapping bug?

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Ido Flatow
Posts: 8
Joined: Tue 21 Apr 2009 07:50

ModificationFunctionMapping bug?

Post by Ido Flatow » 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.

Ido Flatow
Posts: 8
Joined: Tue 21 Apr 2009 07:50

Can't get it to work with stored procedure as well

Post by Ido Flatow » Wed 22 Apr 2009 08:48

I tried to write a simple stored procedure to see if I can use it instead of the command text.

I've created the stored procedure with a "ref cursor" out parameter, and checked it with simple OracleCommand to see if it works - and it does.

I then tried to update the edmx file without success:
1. If I declare the ref cursor parameter in the ssdl function, I get an error in the msl because I don't have anything to map that parameter to (no scalar is of ref cursor type)
2. If I don't declare the ref cursor in the parameters, the savechanges fails because the number of parameters in the command and in the SP does not match.

So ... How can you call a stored procedure that needs to set result bindings for an insert/udpate/delete function mappings?

I hope someone will have the answer because otherwise we'll have to get back to using sql server ...

Thanks in advance,
Ido Flatow.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 23 Apr 2009 09:40

This problem was discussed here:
http://devart.com/forums/viewtopic.php?t=14031

Post Reply