This is a migrated thread and some comments may be shown as answers.

Running a SP that does an insert

1 Answer 12 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 07 Jul 2016, 07:35 PM

We have a SP that does this

- Check for records
- If none exist, insert them
- Return result

So when I run the SP though OA\DA the insert never happens, if I run it though sql management studio, all is good.  However if I add this.Context.SaveChanges(), the insert works...?  In every case the SP does return the proper data...

What's going on here, how is the context preventing the insert?

1 Answer, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 11 Jul 2016, 03:26 PM
Hi Steve,

Telerik Data Access will execute the stored procedure in a transaction but it will not commit it automatically - it will expect explicit call to .SaveChanges() to do so. This is done to allow the user to combine the stored procedure call with other actions and commit them all as a single transaction.

This is why, when the stored procedure is invoked, you receive the record, but the that record is not actually persisted until .SaveChanges() is called. 
This is the expected behavior and I do not think you can get around it. Could I kindly ask you tell us more about the issue you are experiencing?

Please refer to this documentation article for further information on how to handle transactions with Telerik Data Access


I hope this is helpful. Do get back to us with any further questions. 

Regards,
Boyan
Telerik by Progress
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Boyan
Telerik team
Share this question
or