Page 1 of 1

Web API and Database Transactions

PostPosted: Sun Mar 11, 2018 4:12 pm
by SBarnes
Hi Mike,

Is there anywhere in Web API plugin that uses database transactions, preferably with an ORM Lite database transaction?

I have a situation with a current client where they have two tables in the database header and lines, non Jiwa tables in a Jiwa database, think of a sales order for a similar analogy, and there are already stored procedures that exist to write data to both tables which I can generate the necessary code for through the T4 templates and can extend the API in my own version of a Web API Plugin to get data into the tables but would obviously prefer to have an all or nothing scenario in terms of writing to both tables in terms of the data submitted.

Thanks for any help you can provide on this.

Re: Web API and Database Transactions  Topic is solved

PostPosted: Mon Mar 12, 2018 9:05 am
by Mike.Sheen
SBarnes wrote:Hi Mike,

Is there anywhere in Web API plugin that uses database transactions, preferably with an ORM Lite database transaction?

I have a situation with a current client where they have two tables in the database header and lines, non Jiwa tables in a Jiwa database, think of a sales order for a similar analogy, and there are already stored procedures that exist to write data to both tables which I can generate the necessary code for through the T4 templates and can extend the API in my own version of a Web API Plugin to get data into the tables but would obviously prefer to have an all or nothing scenario in terms of writing to both tables in terms of the data submitted.

Thanks for any help you can provide on this.


Hi Stuart,

No - we have no examples, but ServiceStack has some examples in their documentation of how to use transactions with ORM Lite.

Mike

Re: Web API and Database Transactions

PostPosted: Mon Mar 12, 2018 9:08 am
by SBarnes
Thanks.